开发者

Undefined symbols for architecture i386 [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Duplicate:

symbol(s) not found for architecture 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:

    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-c开发者_如何学运维lass-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.


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.

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.


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

QuartzCore.framework

For the bug

Undefined symbols for architecture i386:


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:

"_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 *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.


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

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.

ENJOY

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜