Re: C++ in precompile
Re: C++ in precompile
- Subject: Re: C++ in precompile
- From: Eric Albert <email@hidden>
- Date: Tue, 6 Dec 2005 09:48:12 -0800
On Dec 6, 2005, at 9:12 AM, Rob Crawford wrote:
I have a precompile that has C++ in it (came over from CodeWarrior), a
lot of forward declared class and such. In the beginning you could not
have C++ in precompiles in ProjectBuilder, is this still the case
XCode and if not, what do you need to do to tell the precompile to
compile with C++?
precompile looks something like this....
#include <Carbon/Carbon.h>
class myClass;
I get errors on the "class myClass;" line.
You can certainly have C++ code in precompiled headers. The thing
you're hitting is that Xcode builds a precompiled header for every
language in your project, so if you have C code Xcode will build a C
version of the precompiled header in addition to the C++ version.
The fix is to use #ifdef __cplusplus, like this:
#include <Carbon/Carbon.h>
#ifdef __cplusplus
class myClass;
#endif
If you want to have Objective-C code in your precompiled header, you
can do the same with #ifdef __OBJC__.
Hope this helps,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden