Re: [Dev-C++] Global variables (linking errors)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Graeme F. <gr...@dr...> - 2002-04-20 12:47:00
|
On a slightly different tack, it is often desirable to have a header file included multiple times. However that may cause problems if you end up with multiple definitions. To avoid that header guards should be used. These will have a pre-processor directive around the entire file #ifndef __MyHeaderFile_H #define __MyHeaderFile_H // add some declarations and definitions here... #endif This will expand the code only once but allow the file to be included multiple times. Now all you have to be wary of is circular #includes, where file A includes B and B includes A. That causes the compiler to get terribly frustrated. Graeme. |