public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Two identical typedefs not allowed?
@ 2001-11-15 11:34 Johan Walles
  2001-11-15 17:33 ` Chris Trawick
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Walles @ 2001-11-15 11:34 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Two identical typedefs not allowed?
  2001-11-15 11:34 Two identical typedefs not allowed? Johan Walles
@ 2001-11-15 17:33 ` Chris Trawick
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Trawick @ 2001-11-15 17:33 UTC (permalink / raw)
  To: Johan Walles; +Cc: gcc-help

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
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-11-22 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-15 11:34 Two identical typedefs not allowed? Johan Walles
2001-11-15 17:33 ` Chris Trawick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).