ios 链接器命令错误:“ld:找不到架构 i386 的符号”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11553409/
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
Linker command error: 'ld: symbol(s) not found for architecture i386'
提问by Siddharthan Asokan
I have an error at compile time. Seems to be weird. it worked as detail view application, but using single view doesn't seem to work. this is the error details:
我在编译时出错。好像很奇怪。它用作详细视图应用程序,但使用单个视图似乎不起作用。这是错误详细信息:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_RssArticle", referenced from:
objc-class-ref in RssXmlParser.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
回答by iOS Test
Try these steps:
尝试以下步骤:
Open your project in XCode.
In left side window/panel of XCode click on your project name on top.
Now select Target from right side panel of XCode.
Select Build Phases from right panel's top. (here other option will be Build Settings, Build Rules)
In the same panel open the "Compile sources", here check: are all the files (
.m
) listed? if not all files click on (+) sign in bottom to add (.m
) files which is not in listAs per your error it seems RssXmlParser not there, add this and compile again
在 XCode 中打开您的项目。
在 XCode 的左侧窗口/面板中,单击顶部的项目名称。
现在从 XCode 的右侧面板中选择 Target。
从右侧面板的顶部选择构建阶段。(这里的其他选项将是构建设置、构建规则)
在同一面板中打开“编译源”,在这里检查:是否
.m
列出了所有文件 ( )?如果不是所有文件,请单击底部的 (+) 符号以添加 (.m
) 不在列表中的文件根据您的错误,似乎 RssXmlParser 不存在,添加并再次编译
It will work fine now.
现在它会正常工作。
回答by vp_gold
don't see anybody suggesting to go to terminal and go to the directory where the project is and run
没有看到有人建议去终端并转到项目所在的目录并运行
xcodebuild -verbose
xcodebuild -verbose
to see detailed error and just reading the error helps a lot of the time
查看详细的错误,只是阅读错误有很多时间
回答by Dean
I realized I had to use the .xcworkspace file instead of the .xcodeproj file.
我意识到我必须使用 .xcworkspace 文件而不是 .xcodeproj 文件。
回答by Oscar
Product -> Clean then Product -> Run :)
产品 -> 清洁然后产品 -> 运行 :)
回答by Kevin
In my case, I mistakenly created a new subclass of UIView
with .h
and .c
files instead of .h
and .m
files. Changing the extensions was easy, but I didn't think to change the contents of the .m
files. So my .h
files had
就我而言,我错误地创建了一个新的UIView
with.h
和.c
files子类,而不是.h
and.m
文件。更改扩展名很容易,但我没想到要更改.m
文件的内容。所以我的.h
文件有
#ifndef My_Project_MPMyView_h
#define My_Project_MPMyView_h
#import <UIKit/UIKit.h>
@interface MPMyView : UIView
@end
#endif
and my .m
files incorrectly had
我的.m
文件错误地有
#include <stdio.h>
When I changed my .m
files to
当我将.m
文件更改为
@interface MPMyView : UIView
@end
@implementation MPMyView
@end
The linker error was fixed.
链接器错误已修复。
回答by Insite Mobilellc
I solved the same issue because I created components as separate projects. After adding the folders to the main project, I forgot to delete the .plist, .string and extra main.m files from the imported component group directories.
我解决了同样的问题,因为我将组件创建为单独的项目。将文件夹添加到主项目后,我忘记从导入的组件组目录中删除 .plist、.string 和额外的 main.m 文件。
Deleting these solved my issue because the app was obviously getting conflicting build commands...
删除这些解决了我的问题,因为该应用程序显然收到了冲突的构建命令......
回答by DanWebster
I encountered this error due to duplicate filenames (I had created NSManagedObjectContext subclasses automatically in core data through the editor menu).
由于文件名重复,我遇到了这个错误(我通过编辑器菜单在核心数据中自动创建了 NSManagedObjectContext 子类)。
As of XCODE 5.0, just quit and restart and xcode should recognize this and fix it for you if you click on the yellow warning in the left hand pane
从 XCODE 5.0 开始,只需退出并重新启动,如果您单击左侧窗格中的黄色警告,xcode 应该会识别并修复它
回答by Harry.Wang
I think it might be that you are trying to create two different .C file (with main function) in one project. C only allows you to have one main entrance every project.
我认为可能是您试图在一个项目中创建两个不同的 .C 文件(带有 main 函数)。C 只允许您每个项目有一个主入口。
回答by haitham
A similar error just happened to me on Xcode 6.4. Seems like an Xcode bug.
我在 Xcode 6.4 上发生了类似的错误。似乎是 Xcode 错误。
My fix was to go to the ".o" file that caused the error, uncheck and recheck target memberships that you need.
我的解决方法是转到导致错误的“.o”文件,取消选中并重新检查您需要的目标成员资格。
回答by yubaraj poudel
I don't know how it worked.But i simply closed the xcode and open again by clicking xcworkspace file and worked for me. you may try hopefully this can solve your problem thank you.
我不知道它是如何工作的。但我只是关闭了 xcode 并通过单击 xcworkspace 文件再次打开并为我工作。您可以尝试希望这可以解决您的问题,谢谢。