Skip to main content
gamedev.net
🔒 Locked

Odd Compiler Error

Started by DragonGeo2 Dec 13, 2005 at 5:06 PM 0 replies 300+ views
Original Post
DragonGeo2
DragonGeo2
My compiler (VStudio.net 2003 edition with Visual C++ 7) will not compile a program for me because it thinks I'm trying to redefine previosly defined code. Here's a sample file I created and linked into my project:

#ifndef READER_CLASS
#define READER_CLASS
#error ERROR!!!!!
#endif


For some reason, when compiling, the #error is going off more than once, which is probably the same reason that my compiler thinks I'm trying to do everything twice in the real code. Can someone help me fix this? Every time I try to compile as usual, I get many
Quote:
linker error : LNK2005
errors (and sometimes one LNK1169 error). Help please?
SiCrane
SiCrane
Inclusion guards only prevent a header from being processed more than once per source file. Chances are that you are defining global variables or non-inline functions in your header files, which are both non-kosher. See this article for the proper way to declare global variables and functions in header files.

Topic Locked

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

Sign in to reply to this topic.