sqlite-C編程-error-

來源:互聯網
上載者:User

標籤:

-------------------------------------------------------

/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-

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.