delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/09/12:31:16

From: Mark McDougall <msmcdoug AT zeta DOT org DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: redefinition errors
Date: Wed, 10 Jun 1998 02:19:21 +1000
Organization: Technetium Development Pty Ltd
Lines: 32
Message-ID: <357D6089.E672DD86@zeta.org.au>
References: <6ljjql$pnd$1 AT nnrp1 DOT dejanews DOT com>
NNTP-Posting-Host: d15.syd2.zeta.org.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

vooder AT my-dejanews DOT com wrote:
> 
> I am getting "error, redefinition of ..." errors in my include file.
> Immediately below this error is another error "... previously declared here".
> These errors reference the same line.  How can I tell where the declaration
> was previously made?

There's no 'easy' way to tell where...

Sounds like you're including the same header twice in the same module,
usually done by #including headers inside other headers (which I tend to
avoid unless it /really/ makes sense to do it), but it all comes down to
a question of style (now donning anti-flame underwear...)

In any case, I use the following lines in EVERY header, regardless...
for example, for include file foo.h

#ifndef __FOO_H__
#define __FOO_H__

(body of include file goes here)

#endif

That way, you won't get these problems... but of course it allows you to
get lazy...

--
|          Mark McDougall          |
|  Technetium Development Pty Ltd  | "Electrical Engineers do it 
|       msmcdoug AT zeta DOT org DOT au       |    with less resistance!"
| http://www.zeta.org.au/~msmcdoug |

- Raw text -


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