Error Accessing a Structure

Started by
6 comments, last by macnihilist 13 years, 6 months ago
Hi!
I've declared a struct named CameraType globally in a file called GameManager.h. I'm trying to access it like this: CameraType cType; in a file called GamePlayState.cpp. I got the following error:

IntelliSense: identifier "CameraType" is undefined d:\goldminer\source\game\gameplaystate.cpp 109

I've also included the GameManager.h file to the GamePlayState.cpp file. How to overcome this error?



[Edited by - ratha on October 14, 2010 7:49:50 AM]
Advertisement
Post code (using source tags) please.
struct CameraType{ core::vector3df FRONTCAM; core::vector3df BEHINDCAM; core::vector3df TOPCAM;};


I'm creating a variable of this structure in another file called GamePlayState.cpp like this:

CameraType cType;

inside a function.
Did you put an extern declaration for cType in your header?
Um... Shouldn't that be
typedef struct{ core::vector3df FRONTCAM; core::vector3df BEHINDCAM; core::vector3df TOPCAM;} CameraType;
instead?
That's not necessary in C++.
Quote:Original post by SiCrane
That's not necessary in C++.

Ok. I'm a C caveman...
IntelliSense: identifier "CameraType" is undefined d:\goldminer\source\game\gameplaystate.cpp 109


Erm, does the build actually fail? Because this message looks more like IntelliSense is confused than like a compiler error. (Or did you just copy the error message from some mouse-over window?)

This topic is closed to new replies.

Advertisement