【问题标题】:Link Errors when building for Device for Iphone为 iPhone 构建设备时出现链接错误
【发布时间】:2010-08-06 19:36:28
【问题描述】:

嗨,我已经为这些错误苦苦挣扎了一天。

我正在为 iphone 使用 TouchJSON 框架 (http://code.google.com/p/touchcode/)。在 iphone 模拟器上一切都可以正常编译,但是当我尝试在设备上编译时出现链接错误。

未定义的符号:

"___switch8", referenced from:
  -[NetworkController constructByteMessage:command:] in NetworkController.o
  -[CJSONScanner scanJSONObject:error:] in CJSONScanner.o

"___restore_vfp_d8_d15_regs", referenced from:
  +[CJSONDataSerializer initialize] in CJSONDataSerializer.o

"___save_vfp_d8_d15_regs", referenced from:
  +[CJSONDataSerializer initialize] in CJSONDataSerializer.o

"___switchu8", referenced from:
  -[CJSONScanner scanJSONStringConstant:error:] in CJSONScanner.o

ld: symbol(s) not found
collect2: ld returned 1 exit status

NetworkController 是我的一个类,它使用 touchJSON 方法来解析和生成 JSON。我认为这是导致大多数链接错误的 touchJSON 库,所以我尝试了另一个框架 json 框架,但它仍然导致 1 个错误。

我尝试从“调试”更改为“发布”,但仍然出现相同的错误。然后我尝试将 -all_load 和 -ObjC 添加到链接器标志,但它仍然出错。任何帮助或提示将不胜感激。

【问题讨论】:

    标签: iphone linker device


    【解决方案1】:

    如果您无法修复链接器错误,您可以尝试使用json-framework 而不是 touchJSON。

    【讨论】:

    • 我尝试使用 json 框架,它给了我一个类似的错误。 “___switch32”,引用自:-[SBJsonParser scanRestOfString:] in SBJsonParser.o
    【解决方案2】:

    这看起来像是 switch 语句的一些不错的小错误,这显然是 Objective-C 中的函数/宏/任何东西,至少现在在 iOS4 中。这一切都非常令人困惑。将-lobjc 添加到链接器标志有帮助吗?

    【讨论】:

    • 我尝试将 -lobjc 添加到项目和目标的“其他链接器标志”中,但仍然出现错误。非常感谢到目前为止的帮助。
    • 我发现如果我将编译器切换到 llvm gcc 4.2 那么它会成功构建。我希望它能够成功地为 gcc 4.2 构建。
    猜你喜欢
    • 2013-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-26
    • 2013-10-06
    • 1970-01-01
    • 2011-07-16
    相关资源
    最近更新 更多