Re: [Dev-C++] Multiply-included header problem
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <or...@vp...> - 2003-07-27 08:34:58
|
FerretallicA wrote: > Oo oi, > > OK got it working... I tried the following code and it made no difference, > but I tried doing a clean build and now it's worked. The solution is basic, > but here it is anyway for those who might run into this problem at some > point. > > MAIN.H > #ifndef PRAGMAONCE > #define PRAGMAONCE > int some_important_variable; > #endif > > > PRAGMAONCE can be renamed to whatever you feel like if you really want. It actually SHOULD be renamed, and it should also be unique in each header file. Because if not, some header files will not be included. So I suggest, you name it something like this: #ifndef _MAIN_H_ #define _MAIN_H_ int some_important_variable; #endif -- Greetings, Balázs |