Search code examples
architectureundefinedsymbolsios-simulatori386

Error Message: Undefined symbols for architecture i386 using ZBar Libraries


I'm having a problem right now with a project I'm trying to build in Xcode 4.0, hopefully someone can shed some light on this for me..

I'm trying to use the ZBar SDK and have followed the instructions outlined in the guideline outlined here:

http://zbar.sourceforge.net/iphone/sdkdoc/camera.html

however, i'm getting the same error. I checked out John's post, however, the path he mentioned wasn't in my LIBRARY_SEARCH_PATH's.

I'm using Xcode 4.0, and am trying to build my project for the iPad 4.3 Simulator.

(Error I'm getting):

Undefined symbols for architecture i386:
  "_objc_msgSend", referenced from:
  _main in main.o
  -[PrototypeAppDelegate application:didFinishLaunchingWithOptions:] in PrototypeAppDelegate.o
  -[PrototypeAppDelegate dealloc] in PrototypeAppDelegate.o
  -[Home loadGRView] in Home.o
  ...
"_UIApplicationMain", referenced from:
  _main in main.o
"_OBJC_CLASS_$_NSAutoreleasePool", referenced from:
  objc-class-ref in main.o
"_objc_msgSendSuper2", referenced from:
  -[PrototypeAppDelegate dealloc] in PrototypeAppDelegate.o
  -[PrototypeAppDelegate_iPhone dealloc] in PrototypeAppDelegate_iPhone.o
  ...
"_objc_setProperty", referenced from:
  -[PrototypeAppDelegate setTabBarController:] in PrototypeAppDelegate.o
  -[PrototypeAppDelegate setTheNavController:] in PrototypeAppDelegate.o
  ...

etc.

I've tried looking at the ReaderSample code included with the ZBar sdk, and thought the issue was that I was missing a couple frameworks that they used in their app, but including those frameworks just increased the number of errors i'm getting. Is this a Build setting issue? Does anyone have ideas of what I can try doing?

P.S: I found two threads similar to this problem, and tried the various solutions they recommended and still couldn't get a solution

-http://stackoverflow.com/questions/1452466/suddenly-i-am-not-able-to-build-for-the-iphone-simulator -http://stackoverflow.com/questions/1456185/build-error-missing-required-architecture-i386-in-file/1467238#1467238

I hope I'm using this thread correctly... I'm relatively new to stack overflow. T


Solution

  • I was able to play around and get it working.

    I updated Xcode to 4.0.2. Also, the documentation for ZBar forgot to mention the other frameworks needed to use the SDK (Take a look at the ReaderSample application). The 7 frameworks need to be in the following order:

    Foundation.framework
    CoreGraphics.framework
    UIKit.framework
    AVFoundation.framework
    CoreMedia.framework
    CoreVideo.framework
    QuartzCore.framework
    libiconv.dylib
    libzbar.a
    

    I wasn't aware the order the frameworks are declared in the Build Phases mattered. Anyways, hopefully for anybody trying to integrate a barcode scanner into their app, this answer will be useful.