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

Started by
2 comments, last by sanguineraven 20 years, 3 months ago
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]
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."
-------------VenDrakeTo understand recursion, you must first understand recursion.
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]
PEH! Where is my credit? I helped you fix it, and no credit for me? PEH!

Toolmaker


-Earth is 98% full. Please delete anybody you can.

This topic is closed to new replies.

Advertisement