2

I am trying to incorporate CorePlot into my project. I finally manages to get my header files recognized but i keep getting the following error in my main.m.

"Expected expression before '@' token"

int main(int argc, char *argv[])
{ 
    @autoreleasepool { 
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([ProjectFiveAppDelegate     class]));
    }
}
Kevin McFadden
  • 337
  • 1
  • 5
  • 23

1 Answers1

6

The @autoreleasepool syntax was introduced fairly recently, you probably need to install Xcode 4.2. Another possibility is that your compiler is set to GCC which AFAIK doesn't support those newer Objective-C changes.

If this is the only place where newer Objective-C extensions are used, you can simply change it to

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain( ...
[pool release];
return retVal;
Caffeine
  • 862
  • 7
  • 6
  • Thanks Caffeine! THat did the trick. I was actually running Xcode Version 4.2 (Build 4C199). THis has saved me so much time! – Kevin McFadden Dec 20 '11 at 01:58
  • Thanks for the detail about the GCC compiler. I left the @autoreleasepool syntax and changed the compiler from GCC LLVM 4.2 to Apple LLVM 4.1 and that also resolved the issue. – kennbrodhagen Oct 22 '12 at 02:34