xcode 架构 i386 的未定义符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6610709/
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 i386
提问by highthem
Possible Duplicate:
symbol(s) not found for architecture i386
可能的重复:
找不到架构 i386 的符号
I have an app to complete, and when I start trying to understand what the previous developer did (it was done with Xcode 3 I think) by executing the simulator, Xcode 4 show me 25 issues:
我有一个应用程序要完成,当我开始尝试通过执行模拟器来理解前一个开发人员做了什么(我认为是用 Xcode 3 完成的)时,Xcode 4 显示了 25 个问题:
Ld build/Debug-iphonesimulator/RadioPlayer.app/RadioPlayer normal i386
cd /Users/haithembenhammouda/Desktop/SonVidéo
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/haithembenhammouda/Desktop/SonVidéo/build/Debug-iphonesimulator -L/Users/haithembenhammouda/Desktop/SonVidéo/Classes/RadioKitLib -L/Users/haithembenhammouda/Desktop/SonVidéo -F/Users/haithembenhammouda/Desktop/SonVidéo/build/Debug-iphonesimulator -filelist /Users/haithembenhammouda/Desktop/SonVidéo/build/SonVidéo.build/Debug-iphonesimulator/RadioPlayer.build/Objects-normal/i386/RadioPlayer.LinkFileList -mmacosx-version-min=10.6 -ObjC -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework SystemConfiguration -framework MediaPlayer -framework CFNetwork -framework AudioToolbox -framework QuartzCore -lsqlite3.0 -framework AVFoundation -lRadioKit -framework MessageUI -o /Users/haithembenhammouda/Desktop/SonVidéo/build/Debug-iphonesimulator/RadioPlayer.app/RadioPlayer
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_RadioKit", referenced from:
objc-class-ref in RadioPlayerViewController.o
".objc_class_name_UIColor", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(BufferView.o)
".objc_class_name_UIView", referenced from:
.objc_class_name_BufferView in libRadioKit.a(BufferView.o)
".objc_class_name_NSObject", referenced from:
.objc_class_name_ASE_Event in libRadioKit.a(ASE_Event.o)
.objc_class_name_AudioStreamEngine in libRadioKit.a(AudioStreamEngine.o)
.objc_class_name_RadioKit in libRadioKit.a(RadioKit.o)
.objc_class_name_XMLMetaParser in libRadioKit.a(XMLMetaParser.o)
".objc_class_name_NSDate", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSValue", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSScanner", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSCharacterSet", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSAutoreleasePool", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
pointer-to-literal-objc-class-name in libRadioKit.a(XMLMetaParser.o)
pointer-to-literal-objc-class-name in libRadioKit.a(reachability.o)
".objc_class_name_NSFileManager", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
".objc_class_name_NSURLConnection", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
pointer-to-literal-objc-class-name in libRadioKit.a(XMLMetaParser.o)
".objc_class_name_NSThread", referenced from:
pointer-to-literal-objc-class-name in libRadioKit.a(AudioStreamEngine.o)
.....(etc)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
PS: I checked frameworks and all of them exist.
PS:我检查了框架,它们都存在。
回答by StuR
A bit late to the party but might be valuable to someone with this error..
参加聚会有点晚,但对于有此错误的人来说可能很有价值..
I just straight copied a bunch of files into an Xcode project, if you forget to add them to your projects Build Phases you will get the error "Undefined symbols for architecture i386". So add your implementation files to Compile Sources, and Xib files to Copy Bundle Resources.
我只是直接将一堆文件复制到 Xcode 项目中,如果您忘记将它们添加到您的项目构建阶段,您将收到错误“架构 i386 的未定义符号”。因此,将您的实现文件添加到 Compile Sources,并将 Xib 文件添加到 Copy Bundle Resources。
The error was telling me that there was no link to my classes simply because they weren't included in the Compile Sources, quite obvious really but may save someone a headache.
错误告诉我没有链接到我的类只是因为它们没有包含在编译源中,这真的很明显,但可能会让某人头疼。
回答by Rajesh
Add the framework required for the method used in the project target in the "Link Binaries With Libraries" list of Build Phases, it will work easily. Like I have imported to my project
在Build Phases的“Link Binaries With Libraries”列表中添加项目目标中使用的方法所需的框架,即可轻松使用。就像我已经导入到我的项目
QuartzCore.framework
For the bug
对于错误
Undefined symbols for architecture i386:
架构 i386 的未定义符号:
回答by whyoz
At the risk of sounding obvious, always check the spelling of your forward class files. Sometimes XCode (at least XCode 4.3.2) will turn a declaration green that's actually camel cased incorrectly. Like in this example:
冒着听起来很明显的风险,请始终检查转发类文件的拼写。有时 XCode(至少 XCode 4.3.2)会将声明变成绿色,实际上是错误的驼峰式大小写。就像在这个例子中:
"_OBJC_CLASS_$_RadioKit", referenced from:
objc-class-ref in RadioPlayerViewController.o
If RadioKit was a class file and you make it a property of another file, in the interface declaration, you might see that
如果 RadioKit 是一个类文件,而您将其设为另一个文件的属性,则在接口声明中,您可能会看到
Radiokit *rk;
has "Radiokit" in green when the actual decalaration should be:
当实际声明应该是:
RadioKit *rk;
This error will also throw this type of error. Another example (in my case), is when you have _iPhone and _iphone extensions on your class names for universal apps. Once I changed the appropriate file from _iphone to the correct _iPhone, the errors went away.
此错误也会引发此类错误。另一个例子(在我的例子中)是当你的通用应用程序的类名上有 _iPhone 和 _iphone 扩展时。一旦我将适当的文件从 _iphone 更改为正确的 _iPhone,错误就消失了。
回答by highthem
well i found a solution to this problem for who want to work with xCode 4. All what you have to do is importing frameworks from the SimulatorSDK folder /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks
好吧,我为想要使用 xCode 4 的人找到了解决此问题的方法。您所要做的就是从 SimulatorSDK 文件夹/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System导入框架 /图书馆/框架
i don't know if it works when you try to test your app on a real iDevice, but i'm sure that it works on simulator.
我不知道当您尝试在真正的 iDevice 上测试您的应用程序时它是否有效,但我确定它在模拟器上有效。
ENJOY
请享用