Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
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?
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
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.
 

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
I made this on Terminal, so in that case, how do I link it?

P.S. Thank you for your quick response.
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
Append this line when you compile your program:

-L/usr/lib -lsqlite3

for example,

gcc -g -o myprogram myprogram.c -L/usr/lib -lsqlite3
 

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
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!!!
 

jguru

macrumors member
Apr 10, 2008
43
0
how did you solve this issue? i am having the same linking error with XCode..

thanks
 

jguru

macrumors member
Apr 10, 2008
43
0
Add this file to your frameworks

/usr/lib/libsqlite3.0.dylib

and then #import "sqlite3.h"

sorry i am quite new to this whole mac developement.. how would I add that path to the framework?


thanks 4 the help :)
 

ghayenga

macrumors regular
Jun 18, 2008
190
0
sorry i am quite new to this whole mac developement.. how would I add that path to the framework?

thanks 4 the help :)

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.