Using libmysql with Xcode -- help with dynamic library

Discussion in 'Mac Programming' started by jamdr, Mar 20, 2010.

  1. jamdr macrumors 6502a

    jamdr

    Joined:
    Jul 20, 2003
    Location:
    Bay Area
    #1
    I downloaded the dylib's from mysql.com and I added them to my Xcode project, along with the header files. However, whenever I try to compile, I get:

    Code:
    dyld: Library not loaded: libmysql.16.dylib
    Reason: image not found
    I guess I'm not adding the dynamic library to my project properly. Has anyone does this before?
     
  2. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #2
    How are you telling Xcode to link to the library?
     
  3. jamdr thread starter macrumors 6502a

    jamdr

    Joined:
    Jul 20, 2003
    Location:
    Bay Area
    #3
    I'm just right clicking on Linked Frameworks and select Add Existing Frameworks... and selecting the libmysql.dylib. Is there something else I should be doing?

    I've seen other threads on this forum where people mention they are using this library with Xcode, so if any of you are around, please help :eek:
     
  4. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #4
    I haven't used this specific library, but here's a tidbit: a dylib is not a framework. They are linked differently. Next, the "Linked Frameworks" "folder" isn't really how you actually tell Xcode to link to the library. If you "Get Info" on the dylib in Xcode, then click the "Targets" tab, you'll see a list of the targets in your project. You should check the target(s) you want to link against that library.

    There's more to be done when it comes to actually shipping the application, but it's not necessary for building and debugging. (see "otool" and "install_name_tool".)
     

Share This Page