Manpreet Singh Narang
Manpreet Singh Narang

Reputation: 65

Error compiling C++ program

I get this error while compiling: error: aggregate 'X x' has incomplete type and cannot be defined

I have three classes in 6 different files(header file + 3 implementation files). when I try to compile all these classes with a main, It gives me the above error. I am not including any header file in other header files, I am doing that in implementation files. So, I think its not a case of "cross reference". I am not sure what is the problem with my code can anyone help me in that?

Thanks

Upvotes: 0

Views: 132

Answers (1)

GManNickG
GManNickG

Reputation: 504203

Somehow, that class isn't being defined when it needs to be.

Firstly, make sure the header has actually been included. Further, make sure you have include guards, and that you don't have circular includes and recursive definitions. Aside from that, without the code we cannot give specifics.

Upvotes: 2

Related Questions