简体   繁体   中英

Objective-C errors with Xcode

I added a simple class to my Xcode command line tool project. The class is shown below:

#import <Foundation/Foundation.h>

@interface Foo : NSObject {
}
@end

and

#import "Foo.h"

@implementation Foo
@end

As soon as I reference Foo.h using #import "Foo.h" in my main file I get all type of errors. I have Foundation.frameowork added as my frameworks.

/Developer/SDKs/MacOSX10.6.sdk/System/
    Library/Frameworks/Foundation.framework/Headers/
NSObjCRuntime.h:189:1: error: expected identifier or '(' [3]

/Developer/SDKs/MacOSX10.6.sdk/System/
    Library/Frameworks/Foundation.framework/Headers/
NSObjCRuntime.h:197:50: error: unknown type name 'Protocol' [3]

I'm guessing that you probably need to rename main.c to main.m ? Otherwise, can you post the content of your main file?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM