Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Two error messages

This topic is 5403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I get these two error messages... c:\vc++ projects\rpg2\objects.h(1) : error C2374: ''MAX_NUMBER_OF_OBJECTS'' : redefinition; multiple initialization c:\vc++ projects\rpg2\objects.h(1) : see declaration of ''MAX_NUMBER_OF_OBJECTS'' c:\vc++ projects\rpg2\objects.h(15) : error C2011: ''object'' : ''class'' type redefinition In objects.h, I have this: --------------------------------------------------- extern const int MAX_NUMBER_OF_OBJECTS = 256; class object { public: int Health; bool Valid; //int XPosition; //int YPosition; int OBJECT_TYPE; }; ---------------------------------------------------- Any idea whats wrong?

Share this post

Link to post
Share on other sites
Thats not it - You''re declaring the variable as extern - meaning that its going to be initialised in some other file. But you''re initialising it there too.
Change the line to:
extern const int MAX_NUMBER_OF_OBJECTS;
and put this in objects.cpp:
const int MAX_NUMBER_OF_OBJECTS = 256;

Or use #define

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!