ios Xcode 6.1 上 x86_64 架构的未定义符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26559904/
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
Undefined symbols for architecture x86_64 on Xcode 6.1
提问by batistomorrow
All of a sudden Xcode threw me this error at compilation time:
突然之间,Xcode 在编译时向我抛出了这个错误:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Format", referenced from:
objc-class-ref in WOExerciseListViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After doing some research, I may understand that a library I'm using is not compatible with 64 bit version. But this is very strange since I've been working with the same libraries for at least a week without having a single compilation problem during that time. The two libraries are just composed of a bunch of classes, and when I removed them from my project I got the same issue. Since I have never created libraries myself, I have no idea how I can find wether the ones I'm using are compatible with 64 bit (?) I also tried the following changes for architectures under the target panel :
经过一些研究,我可能会了解到我使用的库与 64 位版本不兼容。但这很奇怪,因为我已经使用相同的库至少一个星期了,在那段时间没有遇到任何编译问题。这两个库只是由一堆类组成,当我从我的项目中删除它们时,我遇到了同样的问题。由于我自己从未创建过库,因此我不知道如何找到我正在使用的库是否与 64 位(?)兼容,我还尝试对目标面板下的架构进行以下更改:
- added $(ARCHS_STANDARD_INCLUDING_64_BIT) to the Architectures
- build active architecture only -> set to 'NO'
- for 'valid architectures' -> set to arm64, armv7 and armv7s
- deleted the DerivedData folder and its contents, cleaned and built again
- 将 $(ARCHS_STANDARD_INCLUDING_64_BIT) 添加到架构
- 仅构建活动架构 -> 设置为“NO”
- 对于“有效架构”-> 设置为 arm64、armv7 和 armv7s
- 删除了 DerivedData 文件夹及其内容,重新清理和构建
But none of these changes work. Please, does someone have a clue on this? Thanks
但这些变化都不起作用。请问有人有这方面的线索吗?谢谢
回答by Banane
Apparently, your class "Format" is involved in the problem. Check your declaration of this class, especially if you did it inside another class you probably forgot the @implementation or something similar.
显然,您的课程“格式”与问题有关。检查你对这个类的声明,特别是如果你在另一个类中做了它,你可能忘记了 @implementation 或类似的东西。
回答by user3894518
Check if that file is included in Build Phases -> Compiled Sources
检查该文件是否包含在 Build Phases -> Compiled Sources 中
回答by Youssef Gamil
Make sure the WOExerciseListViewController is a Target Member; that worked for me!
确保 WOExerciseListViewController 是目标成员;这对我有用!
回答by Nishant Mahajan
Yes, I think the library you are using is not compatible with 64 bit version but you can solve the problem -
是的,我认为您使用的库与 64 位版本不兼容,但您可以解决问题-
Just navigate to Build Settings>Architectures & replace $(ARCHS_STANDARD)
to $(ARCHS_STANDARD_32_BIT)
只需导航到构建设置>架构并替换$(ARCHS_STANDARD)
为$(ARCHS_STANDARD_32_BIT)
So that your xcode build your project with 32 bit supported version.
以便您的 xcode 使用 32 位支持版本构建您的项目。
回答by auco
I just had this error when I opened a (quite) old project, created in Xcode 4~ish, in Xcode 6.4. While the linked Frameworks were visible in the Project sidebar, I overlooked that there were no linked libraries in the Target Build Phases tab. Once I fixed that, it compiled fine.
当我在 Xcode 6.4 中打开在 Xcode 4~ish 中创建的(相当)旧项目时,我刚刚遇到此错误。虽然链接的框架在项目侧栏中可见,但我忽略了目标构建阶段选项卡中没有链接的库。一旦我解决了这个问题,它就编译好了。
回答by Alberto M
I simply wasn't linking the libraries in the "Link Binary with Libraries" section.
我只是没有在“链接二进制与库”部分中链接库。
回答by chengbo
It turned out I forgot to write my @implementation
part.
结果我忘了写我的@implementation
部分。
回答by Seif Meddeb
I just had the exact same error, and solved it by restarting xcode.
我刚刚遇到了完全相同的错误,并通过重新启动 xcode 解决了它。
For me the issue occurred after an svn update, the file in question was added to the projects folder, but it never appeared in xcode(9.3.1) – until I restarted it.
对我来说,问题发生在 svn 更新之后,有问题的文件被添加到项目文件夹中,但它从未出现在 xcode(9.3.1) 中——直到我重新启动它。
回答by Hemanshu Liya
I solved the same issue by going to Xcode Build Settings and in Architectures, I changed the Xcode 6.1.1 standard architecture to:-
我通过转到 Xcode Build Settings 并在 Architectures 中解决了同样的问题,我将 Xcode 6.1.1 标准架构更改为:-
$(ARCHS_STANDARD_32_BIT)
$(ARCHS_STANDARD_32_BIT)
回答by zeeawan
Same error when I copied/pasted a class and forgot to rename it in .m file.
当我复制/粘贴一个类并忘记在 .m 文件中重命名它时出现同样的错误。