Hi,

you have to compile sqlite3.c, using something like

gcc -c sqlite3.c

making an object file, and then linking it to your own program. 
Your call combines compiler and linker using only your own source file.

Also, it should not be necessary to define sqlite3_open and sqlite3_close (or 
any other sqlite function), because you already included sqlite3.h

Martin

mrobi...@cs.fiu.edu wrote:
> Sorry,
>
> Maybe I should have included the following details:
>
>
> This is the program:
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <sqlite3.h>
>
>
>
> int sqlite3_open(
>   const char *filename,   /* Database filename (UTF-8) */
>   sqlite3 **ppDb          /* OUT: SQLite db handle */
> );
>
>
> int sqlite3_close(sqlite3 *);
>
>
> int main()
> {
>     printf("hi\n");
>
>     sqlite3 *db;
>     const char KDbName[] = "c:\\test\\Db1.db";
>     int rc = sqlite3_open(KDbName, &db);
>     if (rc)
>     {
>          sqlite3_close (db);
>          return 0;
>     }
>
>
> exit (0);
> }
>
>
> =================================================
>
> and these are the errors when compiling
>
>
>
> C:\SQLite>\gcc\gcc -o s.exe s.c
> C:\DOCUME~1\Michael\LOCALS~1\Temp/ccigbaaa.o:s.c:(.text+0x71): undefined
> referen
> ce to `sqlite3_open'
> C:\DOCUME~1\Michael\LOCALS~1\Temp/ccigbaaa.o:s.c:(.text+0x85): undefined
> referen
> ce to `sqlite3_close'
> collect2: ld returned 1 exit status
>
>
> Thanks for your help,
>
> Michael Robinson
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to