On 2 Mar 2015, at 6:25 PM, Carl Hoefs <[email protected]> wrote:

> I'm trying to build/update an old project for OS X 10.9, but Xcode 6.1.1 is 
> complaining:
>   'Cocoa/Cocoa.h' file not found
> 
> The reference is from the project's prefix.pch file:
> #ifdef __OBJC__
> #import <Cocoa/Cocoa.h>
> #endif
> 
> I've re-added Foundation, Cocoa, and AppKit frameworks, set the SDK to 10.9, 
> and updated the project settings at Xcode’s prompting. What else must I do?

Just for grins, turn module support on in the build settings, and replace the 
above with

#ifdef __OBJC__
@import Cocoa;
#endif

I’d gladly hear why your setup didn’t work — it’s the way Xcode templates do it 
— but that would involve more information.

@import has the advantage of loading the equivalent of the precompiled 
Cocoa/Cocoa.h (and similarly for other frameworks) without the need for a 
precompiled header. In fact, the framework #includes are (I believe) 
implemented as @import behind the scenes, which is why the current templates do 
away with .pch and #import them in every header.

There are other effects (advantages, unless you have legacy problems), but I 
won’t filibuster.

        — F


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to