문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top