Jump to content
  • Advertisement

Archived

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

Windows.h gives me errors with enumerated types [ SOLVED ]

This topic is 5241 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

Ok, I'm relatively new to C++ so there is probably something simple I overlooked or that I don't know. I am working on my Pacman game, and am plugging in certain classes I have designed before. I had programmed a Log class that records events to a text file, which helps me track down errors quickly. In the Log.h file I have this declaration: enum EVENT_TYPE { ERROR, MISC, CONSTRUCTOR, DECONSTRUCTOR }; I also programmed a FrameRate class which I can use for my games. It deals with timing, calculates the FPS, holds delta-time, which I can use for framerate-independent movement. In FrameRate.h I did: #include <windows.h> so I could use the GetTickCount() function to calculate the time of current and last frame. The problem arises when I add both my Log class and FrameRate class to my game. I get the following errors: error C2059: syntax error : 'constant' error C2143: syntax error : missing ';' before '}' error C2143: syntax error : missing ';' before '}' error C2065: 'CONSTRUCTOR' : undeclared identifier error C2065: 'MISC' : undeclared identifier error C2065: 'DECONSTRUCTOR' : undeclared identifier error C2059: syntax error : 'constant' error C2143: syntax error : missing ';' before '}' error C2143: syntax error : missing ';' before '}' The syntax errors are on the line with the ENUM declaration. If I comment out the windows.h include, I get no errors. Is there a conflict between something in windows.h and my enum? I have tried changing the enum name but that did nothing. Again, it's probably something simple I overlooked but thanks for your help [edited by - sanguineraven on January 14, 2004 11:10:13 AM] [edited by - sanguineraven on January 14, 2004 11:16:51 AM]

Share this post


Link to post
Share on other sites
Advertisement
I''m pretty sure EVENT_TYPE and/or ERROR are already defined in one of the windows files. You''re trying to redefine them and the compiler doesn''t understand.



-----------
VenDrake

"My stupid jar is full. I can''t talk to you anymore."

Share this post


Link to post
Share on other sites
Yep just figured it out, your answer confirms it, it was the ERROR that I had to change. I thought you could redefine it in an enum without a prob but obviously not

EDIT: uhh yeah. Thanks to Toolmaker ^_^

[edited by - sanguineraven on January 14, 2004 11:21:34 AM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!