Two identical typedefs not allowed?

Chris Trawick hazard@lords.com
Thu Nov 15 17:33:00 GMT 2001


i can't think of a compiler flag to get gcc to accept that, but i may yet be
of some help.

i assume you're running into this because you're including the same header
twice, right?  or a nice little recursive tree of dependant headers?  that's
when this usually pops up.  try something like this in your headers:

/* start of projectname header.h */
#ifndef __PROJECTNAME_HEADER_H__
#define __PROJECTNAME_HEADER_H__

/* contents of projectname header.h */

#endif /* __PROJECTNAME_HEADER_H__ */
/*end of pojectname header.h */

hope it helps,
chris

----- Original Message -----
From: "Johan Walles" <johan.walles@appeal.se>
To: <gcc-help@gcc.gnu.org>
Sent: Thursday, November 22, 2001 10:47 AM
Subject: Two identical typedefs not allowed?


> Hi!
>
> When I try to compile the following code with gcc-3.0.2...
>
> typedef int adam;
> typedef int adam;
>
> ... I get the following error:
>
> redefinition.c:2: redefinition of `adam'
> redefinition.c:1: `adam' previously declared here
>
> Is there a flag that makes gcc accept this construct?
>
>    Cheers //Johan
>




More information about the Gcc-help mailing list