標籤:
-------------------------------------------------------
/ccrbLiDM.o: In function `main‘:
createtable.c:(.text+0x66): undefined reference to `sqlite_close‘
createtable.c:(.text+0x131): undefined reference to `sqlite_close‘
應該是sqlite3_close
--------------------------------------------------------
sql = "CREATE TABLE COMPANY(" \
"ID INT PRIMARY KEY NOT NULL," \
"NAME TEXT NOT NULL," \
"AGE INT NOT NULL," \
"ADDRESS CHAR(50)," \
"SALARY REAL );"
這個後面少了個;
______________________________________________________________
fprintf(stdout,"open database ok! ok!");
fprintf(stdout,"Table create OK \n\n");
[email protected]:~/sqlite_C# ./createtable
open database ok! ok!Table create OK
fprintf(stdout,"open database ok! ok!"); //在不加\n的情況下
fprintf(stderr,"SQL ERROR: %s \n",sqlite3_errmsg(db1));
fprintf(stderr,"SQL ERROR: %s \n",zErrMsg);
[email protected]:~/sqlite_C# ./createtable
SQL ERROR: table COMPANY already exists
SQL ERROR: table COMPANY already exists
open database ok! ok!
說明:"open database ok! ok! "在進程終結時才從緩衝區輸出到stdout
_______________________________________________________________________________
弄得好好的,可以編譯,這從哪冒出來的
[email protected]:~/sqlite_C#
[email protected]:~/sqlite_C#
[email protected]:~/sqlite_C# gcc -o gettable gettable.c -l sqlite
/usr/bin/ld: cannot find -lsqlite
collect2: error: ld returned 1 exit status
怎麼突然又不行了??
:::原來是這樣,以忘了寫這個3 -lsqlite3
sqlite-C編程-error-