Syntax error before '^' token
I just upgraded core-plot to the latest version in an application that was already running successful plots. I followed the fairly simple instructions to the letter, however I'm getting 20 syntax errors in UIView.h. It seems that I'm not alone, but nobody has of yet posted a solution to the issue.
An example:
This code from UIView.h
+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
gives the compile error "Syntax error before '^' token":
/var/folders/UO/UOZJs7XuF5iROp2HMSTlz++++TI/-Caches-/com.apple.Xcode.501/CompositeSDKs/iphonesimulator-iPhoneSimulator4.0-drysryiarqddqccmfooifrjfbivi/System/Library/Frameworks/UIKit.framework/Headers/UIView.h:250:0 Syntax error before '^' token in /var/folders/UO/UOZJs7XuF5iROp2HMSTlz++++TI/-Caches-/com.apple.Xcode.501/CompositeSDKs/iphonesimulator-iPhoneSimulator4.0-drysryiarqddqccmfooifrjfbivi/System/Library/Frameworks/UIKit.framework/Headers/UIView.h开发者_StackOverflow中文版
It believe the solution is related to the build settings. What would cause this error? I'm not familiar with the (^) syntax in Objective-C.
The ^
in that context is Apple's implementation of blocks.
My first guess is that you're trying to compile the library with GCC 4.0, which does not recognize the syntax. Perhaps try changing your compiler settings to GCC (or LLVM-GCC) 4.2.
Another compiler-related option that may help is to change the compiler away from GCC entirely. If Clang also has trouble with the compilation, chances are it will show you a better error message.
精彩评论