Trouble with structures

Lately Ive been modifying a Wavefront Obj model loader to use textures and Im modifying the "Face" structure to incorporate the texture coordinates into the face but i keep on getting this error

In file included from Video:20,
from Kernel.cpp:15:
Loader:58: error: ‘face::face(int, int, int, int, int)’ cannot be overloaded
Loader:48: error: with ‘face::face(int, int, int, int, int)’
Loader: In function ‘int loadObject(const char*)’:
Loader:170: error: no matching function for call to ‘face::face(int&, int&, int&, int&)’
Loader:48: note: candidates are: face::face(int, int, int, int, int)
Loader:41: note: face::face(const face&)

here is the original code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

struct face
{
 int facenum;
 bool four;
 int faces[4];

 face(int facen,int f1,int f2,int f3) : facenum(facen)//Constructor for triangle
 {  
  faces[0] = f1;
  faces[1] = f2;
  faces[2] = f3;
  four = false;
 }
 
 face(int facen,int f1,int f2,int f3,int f4) : facenum(facen)//Constructor for quad
 { 
  faces[0]=f1;
  faces[1]=f2;
  faces[2]=f3;
  faces[3]=f4;
  four=true;
 }
};


here is my modified code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
struct face
{
 int facenum;
 bool four;
 int faces[4];
 int texcoord[4];
 int mat;
 
 face(int facen,int f1,int f2,int f3,int t1,int t2,int t3,int m) : facenum(facen)//Constructor for triangle
 {  
  faces[0] = f1;
  faces[1] = f2;
  faces[2] = f3;
  
  texcoord[0] = t1;
  texcoord[1] = t2;
  texcoord[2] = t3;
 
  mat = m;

  four = false;
 }
 
 face(int facen,int f1,int f2,int f3,int f4,int t1,int t2,int t3,int t 4,int m) : facenum(facen)//Constructor for quad
 { 
  faces[0]=f1;
  faces[1]=f2;
  faces[2]=f3;
  faces[3]=f4;

  texcoord[0] = t1;
  texcoord[1] = t2;
  texcoord[2] = t3;
  texcoord[3] = t4;

  mat = m;

  four=true;
 }
};


any help would be much appreciated
Last edited on
Are you sure you pass the correct number of arguments to the constructor?
I'm trying to add more arguments to it
closed account (zb0S216C)
Looks like ambiguity to me:

"Loader:58: error: ‘face::face(int, int, int, int, int)’ cannot be overloaded"

"Loader:170: error: no matching function for call to ‘face::face(int&, int&, int&, int&)’"

Wazzak
Last edited on
And how would i fix this?
It's hard to say without seeing the real code.

int t 4 this doesn't look right.
*EDIT* still not working
Last edited on
Topic archived. No new replies allowed.