Mail Archives: djgpp/1997/02/09/13:34:01
SoMeOnE wrote:
>
> Thanks for reading this message....my problem is when I try to make
>and
> include file ( .h ) and include it in multiple C++ files...it comes
>up
> with an error on all int's and char's that they have already been
> defined....I have always had this error with other compilers and I
>know
> it's me that's doing something wrong, not the compiler. If someone
>could
> reply to this and tell me what I am doing wrong, I would greatly
> appreciate it....
>
A neat trick you can try in order to avoid multiple declarations if that
is
your problem is........
-- file.h --
#ifndef file_h
#define file_h
<CODE GOES HERE>
#endif
-- eof --
This way, a source file will never be compiled more than once.
When it is compiled the compiler will define file_h, and then next
time the file will be skipped because file_h is defined.
-Fwec
- Raw text -