I am using Xcode on OSX and the following code would not compile:
#import <Foundation/Foundation.h>
int main(int argc, const char *argv[]) {
@autoreleasepool {
NSLog(@"Hello world!");
}
return 0;
}
However if I remove the autoreleasepool block then the code works. I can also compile and run c and c++ code fine, but if I turn off ARC and write the autorelease the old fashion way:
#import <Foundation/Foundation.h>
int main(int argc, const char *argvc[]) {
NSAutoreleasePool *pool = [[pool alloc] init];
NSLog(@"Hello world!");
[pool drain];
return 0;
}
then the code also doesn't compile.
The full error log is shown here: http://pastebin.com/d9XYUCiG
Edit: I downgraded to XCode 5 from Xcode 5.1.1 I think and now it works.