【问题标题】:How to resolve undefined symbols for architecture i386如何解决架构 i386 的未定义符号
【发布时间】:2015-04-10 23:01:33
【问题描述】:

我最近从 git 存储库下载了一些源代码到 Xcode 6.1.1。但是,对于包含在应用程序中的库(并且存在于我的文件系统上),我得到“缺少所需的架构 i386”。 这是错误:

ld: warning: ignoring file /Users/myname/Documents/mycomp-mycompapp-ios/mycomp/libs/zbar_iOS7_Fix/libzbar.a, missing required architecture i386 in file /Users/myname/Documents/mycomp-mycompapp-ios/mycomp/libs/zbar_iOS7_Fix/libzbar.a (3 slices)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ZBarReaderView", referenced from:
      objc-class-ref in MyViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我看过一些类似的帖子,但我无法确定解决方案是什么 - 它与构建设置有关,我是否要导入另一个库?

【问题讨论】:

    标签: ios xcode linker ld


    【解决方案1】:

    看起来 Xcode 没有在“构建阶段”中链接您的库。以下是修复它的步骤:

    TargetSettings -> Build Phases -> Compile Sources -> 添加您的 ZBarReaderView.m 类(如有必要还添加其他类)-> Build and Run

    【讨论】:

    • 谢谢 - 但我仍然收到相同的错误消息。
    • 重建前你清理了吗?
    • 问题似乎是 .h 文件包含在代码中,但 .m 文件没有。
    • 其实原来是必须在设备本身上运行——可能跟模拟器没有摄像头有关。
    猜你喜欢
    • 2011-08-14
    • 2011-10-30
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多