简体   繁体   English

链接器错误:未定义的符号,未找到符号

[英]Linker error: undefined symbols, symbols not found

I'm getting these Apple Mach-O Linker errors and I don't know how to read these things. 我收到这些Apple Mach-O Linker错误,我不知道如何阅读这些内容。 I got these error after importing "CLCredentialHeader.h" and "CLCredentialHeader.m" in my project. 在我的项目中导入“CLCredentialHeader.h”和“CLCredentialHeader.m”后出现这些错误。

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_SFHFKeychainUtils", referenced from:
      objc-class-ref in CLCredentialHandler.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Make sure that SFHFKeychainUtils.m appears in the "Compile Sources" Build Phase for your build target. 确保SFHFKeychainUtils.m出现在构建目标的“编译源”构建阶段中。 Sometimes, adding files to a project in Xcode doesn't add all implementation files to the appropriate targets. 有时,在Xcode中向项目添加文件不会将所有实现文件添加到适当的目标。

I get this sometimes when I drag and drop a class from another project and forget to mark "add to targets" in the window that pops up. 当我从另一个项目中拖放一个类而忘记在弹出的窗口中标记“添加到目标”时,我有时会得到这个。 I think this is a very legitimate question. 我认为这是一个非常合理的问题。 The error messages are also not very intuitive. 错误消息也不是很直观。 The solution is easy in XCode clicking on the project, and click on "Build Phases" and open the "Compile Source" then say "+". 在XCode点击项目时,解决方案很简单,点击“Build Phases”并打开“Compile Source”然后说“+”。 Here some pictures that say more then all the words. 这里有一些图片说的比所有单词更多。

So if the error looks like this, it tells me DataAccess class is undefined. 因此,如果错误看起来像这样,它告诉我DataAccess类是未定义的。

在此输入图像描述

I recognize this as a class I just dragged and dropped into the project. 我认为这是一个我拖入项目的课程。 I add DataAccess.m to my project 我将DataAccess.m添加到我的项目中

在此输入图像描述

Originally I could have avoided it by marking "Add to targets" 最初我可以通过标记“添加到目标”来避免它

在此输入图像描述

If above answers does not work for you then check you have added Security framework. 如果上述答案对您不起作用,请检查您是否添加了安全框架。 If not then add it in Build Phase section of Targets. 如果没有,则将其添加到目标的构建阶段部分。 Should be fine then :) 应该没关系:)

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

相关问题 链接器错误未定义符号 - linker error Undefined symbols Xcode 8链接器错误与框架,体系结构i386的未定义符号 - Xcode 8 Linker error with Framework, undefined symbols for architecture i386 Xcode 6链接器错误 - 架构armv7的未定义符号 - Xcode 6 linker error - Undefined symbols for architecture armv7 用于架构的未定义符号中的错误 - Error in undefined symbols for architecture 架构错误的未定义符号 - Undefined symbols for architecture error 错误:架构的未定义符号 - Error : Undefined symbols for architecture Parse.framework的链接器错误(未定义符号) - Linker errors (undefined symbols) with Parse.framework Apple Mach-O链接器错误/体系结构i386的未定义符号: - Apple Mach-O Linker Error / Undefined symbols for architecture i386: Apple Mach-O链接器错误-体系结构x86_64的未定义符号:“ _ UISceneWillEnterForegroundNotification”和“ ___isPlatformVersionAtLeast” - Apple Mach-O Linker Error - Undefined symbols for architecture x86_64: “_UISceneWillEnterForegroundNotification” and “___isPlatformVersionAtLeast” 第三方库在体系结构x86_64部分的未定义符号中创建78个链接器错误 - Third part library create 78 linker error in an Undefined symbols for architecture x86_64 section
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM