在 xcode 10 中找不到架构 x86_64 的符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52398504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:46:55  来源:igfitidea点击:

symbol(s) not found for architecture x86_64 in xcode 10

iosxcode

提问by iSara

I have facing the problem in my ios project. symbols not found for architecture x86_64 in xcode clang: error: linker command failed with exit code 1 (use -v to see invocation)

我在我的 ios 项目中遇到了这个问题。在 xcode 中找不到架构 x86_64 的符号clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

在此处输入图片说明

Thanks in advance!!

提前致谢!!

回答by DCDC

I had the exact same problem when running the unit tests for an application that had a custom framework as a dependency. The application was running fine but not its unit tests (I was getting the exact error shown above). I resolved it as follows: - Select the unit test target for the application (e.g. Tests) - Under "Testing" section enable "Allow testing Host Application APIs"

在为具有自定义框架作为依赖项的应用程序运行单元测试时,我遇到了完全相同的问题。该应用程序运行良好,但它的单元测试却不是(我得到了上面显示的确切错误)。我解决了如下问题: - 选择应用程序的单元测试目标(例如测试) - 在“测试”部分下启用“允许测试主机应用程序 API”

回答by Ely

In most cases this points to one or more missing references to frameworks in the section Linked Frameworks And Libraries in the Targets settings of the app in Xcode.

在大多数情况下,这表明 Xcode 中应用程序的 Targets 设置中的 Linked Frameworks And Libraries 部分中缺少一个或多个对框架的引用。

To find out which framework reference should be added:

要找出应该添加哪个框架参考:

  • Right-click on the error in the build time errors list
  • Choose 'Reveal in Log',
  • Search in the log for 'Undefined symbols for architecture x86_64'
  • A list of undefined 'symbols' (mostly class methods and properties) is displayed
  • To find out which framework reference should be added, select such undefined symbol, right-click and choose Search with Google
  • In most cases you'll end up in the documentation of Apple, which should give a clue about the related framework
  • Add the framework in the section Linked Frameworks And Libraries by clicking on the + button.
  • Build the app.
  • If necessary, repeat this procedure for remaining undefined 'symbols'.
  • 右键单击构建时错误列表中的错误
  • 选择“在日志中显示”,
  • 在日志中搜索“架构 x86_64 的未定义符号”
  • 显示未定义的“符号”列表(主要是类方法和属性)
  • 要找出应添加哪个框架引用,请选择此类未定义符号,右键单击并选择使用 Google 搜索
  • 在大多数情况下,您最终会在 Apple 的文档中找到相关框架的线索
  • 通过单击 + 按钮在链接的框架和库部分中添加框架。
  • 构建应用程序。
  • 如有必要,对剩余的未定义“符号”重复此过程。

回答by yoAlex5

It is compile time error that is cased by Static Linker

这是编译时错误 Static Linker

ld: symbol(s) not found for ...
...
Undefined symbols for 

You should add a library or framework to General -> Linked Frameworks and Librariessection

您应该将库或框架添加到General -> Linked Frameworks and Libraries部分

enter image description here

在此处输入图片说明