Developer Forums relocated!

Need help with Apple Developer tools and technologies? Want to share information with other developers and Apple engineers? Visit Developer Forums at Apple.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"syntax error before '@' token" on NSDictionary in command-line utility

Hi - I'm playing around with building a command-line utility in XCode. However, when I attempt to initialize an NSDictionary I get the following error:

"syntax error before '@' token".

Here's the code:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@”red”, @”color1”, nil];

[pool drain];
return 0;
}

The NSDictionary code is identical to example code provided in the XCode docs, and to other code snippets I've found on the web. So, I'm pretty confident that it's not a code problem...

Maybe it's my setup in XCode??
XCode version: 3.1.4
SDK: Mac OSX 10.5 (SDK Base)
Active Configuration: Debug
Under "Targets" > "Link Binary With Libraries" > Foundation.framework > Headers (includes NSDictionary.h)

I downloaded the iPhone SDK (I'm learning iPhone development). Could it be that I can't compile to Mac OSX with a command-line utility with just the iPhone SDK?

Any other ideas?

Thanks in advance!

Mac OS X (10.5)

Posted on Mar 2, 2010 10:34 AM

Reply
17 replies

"syntax error before '@' token" on NSDictionary in command-line utility

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.