Search code examples
ioscocos2d-iphoneadmobadwhirl

Expected expression before '@' token main.m


I added a GoogleAdMobAdsSdkiOS-6.1.4 SDK to my cocos2d app in order to integrate AdWhirl. When I added this Google SDK I got the following error:

Expected expression before '@' token main.m

This is the code looks like:

int main(int argc, char *argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil,
                                 NSStringFromClass([AppDelegate class]));
    }
}

Solution

  • Are you sure that you're using a version of XCode that is 4.2 or above? I think @autoreleasepool is a newer syntax. This also won't work if your compiler is set to GCC. You can also just create your own NSAutoreleasePool using the old syntax if none of this works.

    You can look at another answer to a similar question here.