'^'标记之前的语法错误 [英] Syntax error before '^' token

查看:52
本文介绍了'^'标记之前的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在已经运行成功绘图的应用程序中将核心绘图升级到了最新版本。我按照这封信中相当简单的说明进行操作,但是在UIView.h中出现20个语法错误。 似乎

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.

一个例子:

此代码来自UIView.h

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

它认为解决方案与构建设置有关。什么会导致此错误?我对Objective-C中的(^)语法不熟悉。

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.

推荐答案

^ 是苹果公司 blocks 的实现。

The ^ in that context is Apple's implementation of blocks.

我的第一个猜测是您正在尝试使用无法识别语法的GCC 4.0编译该库。也许尝试将编译器设置更改为GCC(或LLVM-GCC)4.2。

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.

另一个与编译器相关的选项可能会帮助您完全将编译器从GCC移开。如果Clang在编译时也遇到麻烦,则很有可能会向您显示更好的错误消息。

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.

这篇关于'^'标记之前的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆