Monday, 19 September 2011

Error "Undefined symbols for architecture i386: _OBJC_CLASS_$_AVAudioPlayer referenced from: objc-class-ref"

Was away on holiday last week. Of course I brought my MacBook Pro with me. Unfortunately there's no Internet access, which is extremely painful...

I was playing around with the Core Animation Demo by Bob McCune and created this very simple sound testing project.
But whenever I tried to compile the project, as below it kept showing this error:
Undefined symbols for architecture i386: _OBJC_CLASS_$_AVAudioPlayer referenced from: objc-class-ref
And without Internet Access I was stuck for the whole week, biting my finger nails, scratching my head, searched through every PDF I have but couldn't workout anything. I wonder was that something Apple put in to encourage developers to sign in to the developer program??

When I finally got Internet today I quickly searched the net and found quite a few people having same issue. I found this post from stackoverflow most relevant. So it's my fault, I didn't add the AVFoundation framework!! Simple as that, but without the Internet I would never be able to work that out for sure as I never seen that error before.

Next question then is how to do that in Xcode 4?

As shown below, click on "TARGETS" in the middle panel, then click on the "Build Phases", expand the "Link Binary With Libraries", then click the "+" sign.

After added the AVFoundation framework it works like a charm!

I love the feeling when I learned new things or fixed some annoying problems!


  1. iam getting the same error but i have not used any Audio or message framework, simply iam getting like this plz try to help me.....

    Undefined symbols for architecture i386:
    "_OBJC_CLASS_$_KTOneFingerRotationGestureRecognizer", referenced from:
    objc-class-ref in VKLViewController.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    plz try to help me....

  2. please check which framework is required for the "KTOneFingerRotationGestureRecognizer" and add that to your project, that should fix your problem.