Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined symbols for architecture i386 [duplicate]

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-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.

like image 530
highthem Avatar asked Jul 07 '11 12:07

highthem


3 Answers

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.

like image 52
StuR Avatar answered Oct 01 '22 10:10

StuR


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:

like image 39
Rajesh Avatar answered Oct 01 '22 09:10

Rajesh


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.

like image 44
whyoz Avatar answered Oct 01 '22 09:10

whyoz