刚升级到Lion和xcode 4.2。现在当我重新编译我的程序时,我收到了这些错误:
/Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1806:35: current parser token ';'
/Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1762:1: parsing Objective-C method 'updateWithTouchLocationMoved:withEvent:view:'
/Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1762:1: in compound statement ('{}')
/Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1771:2: in compound statement ('{}')
/Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1789:3: in compound statement ('{}')
/Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1796:4: in compound statement ('{}')
/Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1799:5: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
围绕这些行号没有什么奇怪的。没有复合语句,只要简单(a == b)
类型的东西。一些错误行号甚至不在语句上,只是空行或{括号。我怀疑行号不准确。现在我有点死在水里。代码在4.1下编译得很好。
有什么建议吗?
答案 0 :(得分:2)
我阻止编译器崩溃。在逐行注释掉代码行以查看实际发生的位置后,我到达了这一行:
shape.shapeType |= kTypeBreakable;
...做
shape.shapeType = shape.shapeType | kTypeBreakable;
...编译好。那也是......
shape.shapeType |= 0x00000200;
kTypeBreakable
是一个设置为0x00000200
shapeType
只是一个具有getter / setting的obj-c对象变量。
很奇怪的编译器错误。