Skip to main content
gamedev.net
🔒 Locked

enum Type problem

Started by Nox587 Dec 11, 2005 at 12:39 AM 0 replies 650+ views
Original Post
Nox587
Nox587
I have a class like this: class _RockExport IGameEvent { public: virtual ~IGameEvent() {} IGameEvent::EventType mType; Ogre::String mName; enum EventType { EVT_KEY, EVT_GAME, EVT_ANIMATION, EVT_AUDIO }; } and I'm getting these errors: c:\theRock\bumblebee\Source\include\IGameManager.h(18) : error C2146: syntax error : missing ';' before identifier 'mType' c:\theRock\bumblebee\Source\include\IGameManager.h(18) : error C2501: 'theRock::IGameEvent::EventType' : missing storage-class or type specifiers c:\theRock\bumblebee\Source\include\IGameManager.h(18) : error C2501: 'theRock::IGameEvent::mType' : missing storage-class or type specifiers What am I doing wrong here??
RabblePants
RabblePants
You need to declare the variable mType -after- the enum definition, since when the compiler hits "mType" it has not yet encounted an 'EventType' and thus does not know what it is :)

As a general rule, always declare your types first, and then use them :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.