www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/09/13:34:01

To: fighteer AT cs DOT com
Cc: djgpp AT delorie DOT com
Subject: Re: Help With Include Files.....PLEASE!
Message-ID: <19970209.132720.7543.1.fwec@juno.com>
References: <32FC8E53 DOT 77A4 AT praxis DOT net>
<32FD0263 DOT 4DC1 AT cs DOT com>
From: fwec AT juno DOT com (Mark T Logan)
Date: Sun, 09 Feb 1997 13:21:39 EST


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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019