XCode 4.2 clang seg fault [英] XCode 4.2 clang seg fault

查看:293
本文介绍了XCode 4.2 clang seg fault的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚升级到Lion和xcode 4.2。现在当我重新编译我的程序,我得到这些错误:


  1. / Users / XXX / Code / iPhone / XXX / Code / Scenes / GameScene.mm:1806:35:current parser token';'

  2. / Users / XXX / Code / iPhone /XXX/Code/Scenes/GameScene.mm:1762:1:解析Objective-C方法'updateWithTouchLocationMoved:withEvent:view:'

  3. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1762:1:在复合语句('{}')

  4. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1771:2:在复合语句('{}')

  5. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1789:3:在复合语句('{}')

  6. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1796:4:在复合语句')

  7. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1799:5:in复合语句('{}')

    clang:错误:无法执行命令:Segmentation fault:11

    clang:error:clang frontend命令由于信号2失败(使用-v查看调用)

这些行号周围没有什么奇怪的。没有复合语句,只是简单如果(a == b)类型的东西。一些错误行号甚至不在语句上,只是空行或{括号。我怀疑行号不准确。我现在在水里死了。

解决方案

我建议阻止编译器崩溃。在代码行后面注释,看看实际发生的地方我到达这一行:

  shape.shapeType | = kTypeBreakable; 

正在做...

  shape.shapeType = shape.shapeType | kTypeBreakable; 

...编译得很好。 ...

  shape.shapeType | = 0x00000200; 

kTypeBreakable 是一个枚举, 0x00000200



shapeType 只是一个obj-c物件变量与getter /设置。



非常奇怪的编译器错误。


Just upgraded to Lion and xcode 4.2. Now when I recompile my program I getting these errors:

  1. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1806:35: current parser token ';'
  2. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1762:1: parsing Objective-C method 'updateWithTouchLocationMoved:withEvent:view:'
  3. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1762:1: in compound statement ('{}')
  4. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1771:2: in compound statement ('{}')
  5. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1789:3: in compound statement ('{}')
  6. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1796:4: in compound statement ('{}')
  7. /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)

There is nothing odd going on around those line numbers. No compound statements, just simple if (a == b) type stuff. Some of the error line numbers aren't even on statements, just blank lines or a { brace. I suspect that the line numbers are not accurate. I'm kind of dead in the water now. Code compiled fine under 4.1.

Any advice?

解决方案

I stopped the compiler from crashing. After commenting out line after line of code to see where this was actually happening I arrived at this line:

shape.shapeType |= kTypeBreakable;

Doing...

shape.shapeType = shape.shapeType | kTypeBreakable;

...compiles fine. So does...

shape.shapeType |= 0x00000200;

kTypeBreakable is an enum that is set to 0x00000200

shapeType is just a obj-c object variable with a getter/setting.

Very very odd compiler bug.

这篇关于XCode 4.2 clang seg fault的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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