[SDK] SQLite problems

Discussion in 'Mac Programming' started by Duke Leto, May 3, 2008.

  1. Duke Leto macrumors regular

    Joined:
    Mar 17, 2008
    #1
    So I made a database, put in in my Resources, and started coding.

    Now I get errors under "Linking ... (12 errors)"
    For example:
    "_sqlite3_step", referenced from:
    ...
    "_sqlite3_last_insert_rowid", referenced from:
    ...

    <10 more of those>

    What is wrong?
     
  2. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #2
    You need to link to the sqlite3 library: /usr/lib/libsqlite3.0.dylib.

    How you do this depends on whether you're compiling by hand, from a Makefile, or in Xcode.
     
  3. Duke Leto thread starter macrumors regular

    Joined:
    Mar 17, 2008
    #3
    I made this on Terminal, so in that case, how do I link it?

    P.S. Thank you for your quick response.
     
  4. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #4
    Append this line when you compile your program:

    -L/usr/lib -lsqlite3

    for example,

    gcc -g -o myprogram myprogram.c -L/usr/lib -lsqlite3
     
  5. Duke Leto thread starter macrumors regular

    Joined:
    Mar 17, 2008
    #5
    Sorry I meant that I made the database in terminal.. I am compiling by XCode. I guess I read it wrong.

    EDIT: It does not matter because I figured it out. THank you so much!!!
     
  6. jguru macrumors member

    Joined:
    Apr 10, 2008
    #6
    how did you solve this issue? i am having the same linking error with XCode..

    thanks
     
  7. ghayenga macrumors regular

    Joined:
    Jun 18, 2008
    #7
    Add this file to your frameworks

    /usr/lib/libsqlite3.0.dylib

    and then #import "sqlite3.h"
     
  8. jguru macrumors member

    Joined:
    Apr 10, 2008
    #8
    sorry i am quite new to this whole mac developement.. how would I add that path to the framework?


    thanks 4 the help :)
     
  9. ghayenga macrumors regular

    Joined:
    Jun 18, 2008
    #9
    Select the Frameworks folder in your Groups and Files on the left. Under the Project menu choose Add To Project. On your hard drive navigate to the /usr/lib/libsqlite3.0.dylib and choose it.

    Then add the #import "sqlite3.h" to the file with the errors. Done.
     

Share This Page