sqlite-C編程-error-

------------------------------------------------------- sql

/ccrbLiDM.o: In function `main':
createtable.c:(.text+0x66): undefined reference to `sqlite_close'
createtable.c:(.text+0x131): undefined reference to `sqlite_close' ubuntu

應該是sqlite3_close 緩存

-------------------------------------------------------- sqlite

sql = "CREATE TABLE COMPANY("  \ 進程

         "ID INT PRIMARY KEY     NOT NULL," \ get

         "NAME           TEXT    NOT NULL," \ it

         "AGE            INT     NOT NULL," \ io

         "ADDRESS        CHAR(50)," \ 編譯

         "SALARY         REAL );" table

這個後面少了個;

______________________________________________________________

  fprintf(stdout,"open database ok! ok!");

  fprintf(stdout,"Table create OK \n\n");

  root@vm-ubuntu:~/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);  

root@vm-ubuntu:~/sqlite_C# ./createtable

SQL ERROR: table COMPANY already exists

SQL ERROR: table COMPANY already exists

open database ok! ok! 

說明:"open database ok! ok! "在進程終結時才從緩存區輸出到stdout

_______________________________________________________________________________

弄得好好的,能夠編譯,這從哪冒出來的

root@vm-ubuntu:~/sqlite_C#
root@vm-ubuntu:~/sqlite_C#
root@vm-ubuntu:~/sqlite_C# gcc -o gettable gettable.c -l sqlite
/usr/bin/ld: cannot find -lsqlite
collect2: error: ld returned 1 exit status

怎麼忽然又不行了??

:::原來是這樣,以忘了寫這個3                  -lsqlite3

相關文章
相關標籤/搜索