简体   繁体   English

Xcode 9架构x86_64的未定义符号

[英]Xcode 9 undefined symbols for architecture x86_64

after switching to Xcode 9 I am getting errors, it looks like this. 切换到Xcode 9后,我收到错误,看起来像这样。

在此输入图像描述

I blanked the project and classes names, but there is a list of classess ending with .o suffix. 我清空了项目和类名,但是有一个以.o后缀结尾的classess列表。 In Xcode 8.3.2 everything works. 在Xcode 8.3.2中一切正常。 I got 2 projects, one is library that is building without problems. 我有两个项目,一个是没有问题的图书馆。 Another project is test app, that is pointing to the library by :path directive in Podfile. 另一个项目是测试应用程序,它通过以下方式指向库:Podfile中的path指令。 In both projects build settings -> architectures is set to standard arichitectures, build active architectures only is set to DEBUG: Yes, RELEASE: No. Have you come across this problem? 在两个项目中,构建设置 - >架构设置为标准架构,构建活动架构仅设置为DEBUG:是,RELEASE:否。您是否遇到过这个问题? Thanks upfront for the help. 先谢谢你的帮助。

Ran into similar problem. 陷入类似的问题。 Just post it here in case it can help anyone. 只需在此处发布,以防它可以帮助任何人。

Was using class AbcService from a framework (written in Swift 3 and by ourselves) in our app's Objective-c class B. After upgrading from Xcode8/Swift3 to Xcode9/Swift4 it failed to build an archive for the release config, due to Undefined symbols error of this class during linking: 使用类AbcService在我们的应用程序的Objective-C类B.框架(写在斯威夫特3和我们自己)升级从Xcode8 / Swift3到Xcode9 / Swift4后,它没有建立释放配置归档时,由于Undefined symbols链接期间此类的错误:

Undefined symbols for architecture arm64:
   "_OBJC_CLASS_$__TtC15XxxabcServices17AbcService", referenced from:

The weird thing is, it worked fine to archive the debug config, and for running in emulator. 奇怪的是,它可以存档调试配置,并在模拟器中运行。

Spent almost 1 day to find out the root cause: the Swift class AbcService in the framework was missing a public modifier. 花了差不多1天才找出根本原因:框架中的Swift类AbcService缺少一个public修饰符。

这里的简单技巧:转到 - >转到文件夹“/ Library / Developer / Xcode”删除派生数据,然后清理项目,然后运行。

Since you are using Cocoapods you most likely need to update those. 由于您使用的是Cocoapods,因此您很可能需要更新它们。

That means you need to do a pod update on the command line inside your project's directory and then rebuild your project in Xcode. 这意味着您需要在项目目录中的命令行上执行pod update ,然后在Xcode中重建项目。

In general when using a new major version of Xcode it is necessary to rebuild all components. 通常,在使用新的主要版本的Xcode时,必须重建所有组件。 Your error message is telling you that the object files you already have (the *.o files are basically what the compiler produces out of your source files) are not compatible with newly compiled object files (the linker which is complaining in your case has the purpose of combining or 'linking' together all the object files). 您的错误消息告诉您,您已经拥有的目标文件(* .o文件基本上是编译器从源文件中生成的文件)与新编译的目标文件不兼容(在您的情况下抱怨的链接器具有将所有目标文件组合或“链接”在一起的目的。

It might sometimes be necessary to clean your derived data (the stuff Xcode caches). 有时可能需要清理派生数据(Xcode缓存的东西)。 You can do this by going to Xcode's Product menu and while holding down the Option/Alt key, pick the menu item 'clean build folder'. 您可以通过转到Xcode的Product菜单并按住Option / Alt键,选择菜单项“clean build folder”来完成此操作。

When I ran build for profiling, it was working, but with classic build there were mentioned errors. 当我运行构建进行性能分析时,它正在工作,但是经典构建时提到了错误。 After searching through logs it seems there is some weird behaviour with flags, particularly -fprofile-instr-generate. 在搜索日志后,似乎有一些奇怪的行为,特别是-fprofile-instr-generate。 The solution was to set flag Enable Code Coverage to No in build settings of the library project. 解决方案是在库项目的构建设置中将标记Enable Code Coverage设置为No。 This was shooting into the dark but somehow got it working. 这是在黑暗中拍摄但不知何故让它发挥作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM