Incomplete type

Hi,

I have this error in the compiler: "field 'logo' has incomplete type

'logo' is a object "Joint" and it has been declared on joint.h:

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
#ifndef JOINT_H
#define JOINT_H

#include <GL/glew.h>
#include "box.h"
#include "vector"
#include "vertex.h"

class Joint
{
public:
    Joint();
    //many functions.....
    void createLogo();
    Joint getLogo();


private:
 
    //many variables
    Joint logo;

};

#endif // JOINT_H 



Q: ask yourself, how big is a Joint object if you have Line 21 in there?
A: infinite

you need to replace that line with a reference or a pointer to Joint

edit: hint - critical lines are Line 9 and Line 21 - you have defined an object which contains itself - you cannot do this without references or pointers - if you try, as you have, the compiler cannot calculate the value of sizeof( Joint ) because the answer would be infinite
Last edited on
Topic archived. No new replies allowed.