Re: Including Cocoa in a Carbon App
Re: Including Cocoa in a Carbon App
- Subject: Re: Including Cocoa in a Carbon App
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 29 Dec 2010 15:34:04 -0700
On Dec 29, 2010, at 3:24 PM, Jason T. Slack-Moehrle wrote:
> Hello All,
>
> I have a carbon app that I need to put some cocoa functionality in. I am reading some resources on the ADC site.
>
> In my .pch I am adding:
>
> #ifdef __APPLE__ & __MACH__
> #import <Cocoa/Cocoa.h>
> #import <Foundation/Foundation.h>
> #import <AppKit/AppKit.h>
> #endif
>
> I have added the Cocoa and Foundation frameworks to my project, but when I compile my .pch I get about 9761 errors right off the bat.
>
> I am obviously missing something key. What is it?
What you're doing will not work when building C and C++ source code in that project, because those headers include ObjC definitions. If you do have C or C++ source code, then the easiest way to fix this is to use the preprocessor definition __OBJC__ rather than the two you are using above.
Also, if you are importing Cocoa, then you do not need to import or link to Foundation or AppKit or CoreData separately. All the Cocoa framework does is tie those three frameworks together.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden