I'm working on an application that will require an embedded database
backend and Sqlite is looking to be my prime choice here.
Now, I typically write the GUI and the working code seperately anyways
and tie them together later, so I figured I'd begin work on my backend
that talks with the database. I've never actually done any previous
database programming so I'm learning as I go here :).
I'm having trouble getting my (very primitive) experimental program to
link however. Below is my code for test.c:
#include <stdio.h>
#include <sqlite3.h>
int main (int argc, char **argv) {
struct sqlite *pilotLog;
pilotLog = sqlite_open("logbook.dat", 0, NULL);
sqlite_close(pilotLog);
return 0;
}
Now, with the following compiled command:
gcc -Wall -lsqlite3 test.c -o test
I get the following output:
test.c: In function `main':
test.c:9: warning: implicit declaration of function `sqlite_open'
test.c:9: warning: assignment makes pointer from integer without a cast
test.c:11: warning: implicit declaration of function `sqlite_close'
/tmp/ccg3BEWL.o(.text+0x28): In function `main':
: undefined reference to `sqlite_open'
/tmp/ccg3BEWL.o(.text+0x36): In function `main':
: undefined reference to `sqlite_close'
collect2: ld returned 1 exit status
I have verified that the library is there. Normally I would assume that
I had something setup incorrectly, but I've repeated this on both a
completely up-to-date Gentoo Linux box and a FreeBSD 4.10 box, with the
same results. Is there something obvious that I'm missing here? Thanks.
Mike Gaskins