0

I am trying to install core-plot into my iPhone project following these directions. Coreplot requires that I use the LLVM gcc 4.2 compiler, and this is causing notation problems.

Because I am using LLVM gcc 4.2, the @autorelease notation produces the error "Expected expression before '@' token" in main.m.

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

}

Because of this I got rid of the @autoreleasepool notation and changed main to look like the following.

int main(int argc, char *argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    [pool release];
    return retVal;
}

However this gives the 'NSAutoreleasePool is unavailable" error since I am using ARC. So I added the -fno-objc-arc compiler flag to main.m, which gave me and "unrecognized command line option "-fno-objc-arc" error.

Is there a way to resolve the notation problems caused by using LLVC gcc 4.2 while using ARC in my project?

1

1 Answer 1

0

ARC cannot be used with gcc-llvm. You have a few options. You could build CorePlot separately as a static library and link it into your project. You could even embed the CorePlot project file in yours and have it built as a dependency with its own build configuration. You could also switch CorePlot over to clang. I got 1.0 to build once I removed the custom C options. ARC integrates with non-ARC code just fine.

3
  • Thanks, I'll try building as a static library and see how that goes.
    – Bae
    Jun 7, 2012 at 20:44
  • I followed the static library instructions here except for 5. which says to change the C compiler to LLVM GCC 4.2. Everything seems to be working. I'm just curious, do you know why they recommend LLVM GCC 4.2?
    – Bae
    Jun 7, 2012 at 20:53
  • @Rebecca - We don't. Nowhere in the dependent project instructions does it say to use LLVM GCC, and the static library instructions say "Change your C/C++ Compiler in the project build settings to LLVM GCC 4.2 or LLVM 1.6." We're a little out of date, with 3.1 being the current version of the LLVM compiler in Xcode, but we support building with all compilers shipping with Xcode. Personally, I highly recommend following the dependent project instructions (which I wrote) and using LLVM for your project's compiler, because that's the cleanest way to integrate the framework in your application.
    – Brad Larson
    Jun 7, 2012 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.