sqlite-C编程-error-

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

/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");

  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

posted @ 2015-11-16 17:28  cuiz_book  阅读(211)  评论(0编辑  收藏  举报