Jasmine
Jasmine

Reputation: 16245

Including Cocoa.h results in 9646 errors in my project

OS X 10.6.8 XCode 3.2.6

A C++ Carbon Project where I want to include Cocoa.h just for NSLog to debug some problems I am having.

I add Cocoa Framework to my project and I #include <Cocoa/Cocoa.h> in my precompiled header and I get 9646 errors starting with ObjC Runtime stuff.

What have I done wrong?

Update: Some errors:

NSObjCRuntime.h:

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:60:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:60: error: expected unqualified-id before '@' token

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:62:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:62: error: expected constructor, destructor, or type conversion before '*' token

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:63:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:63: error: 'NSString' was not declared in this scope

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:63:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:63: error: 'aSelectorName' was not declared in this scope

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:64:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:64: error: 'NSString' was not declared in this scope

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:64:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:64: error: 'aClassName' was not declared in this scope

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:65:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:65: error: expected constructor, destructor, or type conversion before '*' token

Upvotes: 0

Views: 1508

Answers (1)

Aditya Kumar Pandey
Aditya Kumar Pandey

Reputation: 991

I think you are encountering a problem where some files are treated as pure C/C++ and are not supposed to have Obj C code in them. The solution is to change XCode properties for project and say treat C/C++ files with Obj C or some wording like that.

Upvotes: 2

Related Questions