Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc 4.0 begins complaining of "redefinition of typedef 'foo'



This doesn't address the issue of the #pragma apparently being broken, but you could use the idempotency macro guard trick to prevent your header from being #include'd multiple times:

in foo.h:

#ifndef __FOO_H__ <-- or some similar, unlikely-to-conflict-with- other-symbols symbol
#define __FOO_H__


... (contents of foo.h)

#endif

Tim

On Jun 15, 2005, at 10:25 AM, Bill Monk wrote:

So XCode 2.1/gcc 4.0 has been happily building a codebase which uses "#pragma once" in all its headers.

Suddenly today, building the project produces reams of these errors:

"in file included from /path/foo.h
error: redefinition of typedef 'bar'
previous declaration was here" (where "here" points to header foo.h)



Well, hmm, that looks what you'd see for headers being included more than once.


Seems that I recall some older versions of gcc didn't support #pragma once. Of course, the project has been building just fine with them, but just for grins I turned on warnings for unknown pragmas...however no complaints. for that.


If I remove the supposedly offending inclusion of foo.h, the complaints, unsurprisingly, change to


error: parse error before 'someVariableName'
warning: data definition has no type or storage class


So suddenly XCode 2.1 is giving me a Catch 22. Ideas?











_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >gcc 4.0 begins complaining of "redefinition of typedef 'foo' (From: Bill Monk <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.