-1

I am getting this error

"Incomplete type not allowed"

the line getting this error :

Vec3 MaxHeight;
JTCarlos
  • 17
  • 1
  • 5

3 Answers3

1

you should search first before asking, and you can find the error here and i'm guessing the needed cpp is this in here

add

#include <vec3.h>

to your project

Community
  • 1
  • 1
No Idea For Name
  • 11,411
  • 10
  • 42
  • 70
  • `Vec3` is a very common name for a class, how do you know the library the OP uses? – dyp Sep 16 '13 at 04:38
  • @DyP: What does that matter? I think it's obvious that the intent is to include the declaration of `vec3`, wherever that may be. The most logical guess given what the OP has provided is `vec3.h` – Ed S. Sep 16 '13 at 04:39
  • thank you @EdS. just what i was about to say – No Idea For Name Sep 16 '13 at 04:42
  • Mostly because of "you can find [...] the needed cpp in here". The OP might not use this library and someone downloading it might get confused. If you only guess the name of the header file IMHO you should say so. – dyp Sep 16 '13 at 04:44
  • @DyP i've edited the answer accordingly. – No Idea For Name Sep 16 '13 at 04:48
  • There is no #include – JTCarlos Sep 16 '13 at 09:01
  • @DyP: If someone skipped learning the basics of the language and has no clue as to what constitutes a complete type or how to use header files then they aren't going to get very far by coming to SO anyway. – Ed S. Sep 16 '13 at 17:16
1

Well, to fix it you have to make Vec3 a complete type, i.e. you have to define it (as opposed to merely declaring it).

Note that it is possible that it is not about "including the header file", as the other answers suggest. If you forgot to include the header, the compiler would probably know nothing about Vec3. The error message would be different. In your case the compiler knows Vec3, but it just happens to be incomplete.

What caused this situation is impossible to tell from what you posted (you essentially posted nothing). If you do include the header file that defined Vec3, then the problem might be caused by circular header inclusion or something like that.

AnT stands with Russia
  • 312,472
  • 42
  • 525
  • 765
0

Almost all the time, I come across this by including one file from the library that declares Vec3, but not including the header that includes Vec3 itself.

This happens because sometimes the other headers "forward declare" Vec3 so they can use in their function definitions, but they don't need a complete definition.

Cort Ammon
  • 10,221
  • 31
  • 45