Thanks for your fast response. Now I can compile and test program works fine, but..... When I run: test test.db "select * from tbl1" sqlite3_exec function give me follow error: Unsupported file format.
If I run this query using sqlite3 interactive program all works fine. test.db contatins only tlb1 whith 2 coloumns and 2 records. Any Suggestions ? ----Messaggio originale---- Da: [EMAIL PROTECTED] Data: 26-gen-2006 5.57 PM A: <sqlite-users@sqlite.org> Ogg: Re: [sqlite] How to compile sqlite3 C sample code On Jan 26, 2006, at 11:03 AM, [EMAIL PROTECTED] wrote: > I'm a novice and after compiled and correctly installed SQLite 3.x, > i've tried to compile sample C++ program found in Quickstart page. > I've > got Linker errors, like follows: > > /home/etrax/tmp/cckIV5JC.o: In > function `main': > t.c:(.text+0xd6): undefined reference to > `sqlite3_open' > t.c:(.text+0xee): undefined reference to > `sqlite3_errmsg' > t.c:(.text+0x115): undefined reference to > `sqlite3_close' > t.c:(.text+0x142): undefined reference to > `sqlite3_exec' > t.c:(.text+0x175): undefined reference to > `sqlite3_close' > collect2: ld returned 1 exit status > > Any suggestions ? > I've compiled sqlite3 without errors and using sqlite3 I've created > and > I can use a testDB. > > Regards You need to tell the linker that you're using the SQLite library, and possibly where to find that library. To tell the linker you're using SQLite, just add to your LDFLAGS '- lsqlite3'. If the linker still can't seem to find the sqlite3 library, you may also need to add '- L/usr/local/lib' (assuming you installed SQLite into /usr/local, which is the default destination). A complete makefile might be as simple as the following line: LDFLAGS = -L/usr/local/lib -lsqlite3 Then, just 'make t' should compile and link your test program correctly. HTH, -MIke Ashmore