Undefined symbols for architecture i386 [duplicate]
Asked Answered
B

4

23

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.

Breault answered 7/7, 2011 at 12:37 Comment(2)
Does this post help? #4840481Agglutinate
thanks @JamesMcCormack, that post helped solve my problem :)Janettejaneva
R
24

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.

Resume answered 14/8, 2012 at 21:17 Comment(3)
What if I do not have .m file, I only have the .a file!Careen
Amazing... I was stuck at Apple Mach Link Error for 2 days. Mannn.. u just saved me :-) ThanksGalina
After 3 years this post helped me. wow :)Presentationism
M
21

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:

Matteson answered 13/2, 2012 at 13:15 Comment(0)
H
2

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.

Headpin answered 2/5, 2012 at 20:10 Comment(0)
B
-5

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

Breault answered 21/7, 2011 at 8:12 Comment(1)
What is this..? It will never work.Odontograph

© 2022 - 2024 — McMap. All rights reserved.