Hi, You could also use another open source layer for SQLite3, wxSQLite3 project on sourceforge. It's uses wxWidgets cross-platform C++ toolkit.
best regards, Radzi. On 7-Jul-2010, at 6:09 AM, smengl90 wrote: > > I found out that including the header file alone is not enough. I need to > link the sqlite lib to my project. But how can can I get the lib? > > > > smengl90 wrote: >> >> Thanks for prompt replies. I did as you advised, and included the .h file >> as a source file and copied your code. But when I compiled it, I got these >> linking errors: >> >> 1>Linking... >> 1>TestSqlite.obj : error LNK2019: unresolved external symbol >> _sqlite3_close referenced in function _main >> 1>TestSqlite.obj : error LNK2019: unresolved external symbol _sqlite3_free >> referenced in function _main >> 1>TestSqlite.obj : error LNK2019: unresolved external symbol _sqlite3_exec >> referenced in function _main >> 1>TestSqlite.obj : error LNK2019: unresolved external symbol _sqlite3_open >> referenced in function _main >> 1>C:\Documents and Settings\My Documents\Visual Studio >> 2008\Projects\TestSqlite\Debug\TestSqlite.exe : fatal error LNK1120: 4 >> unresolved externals >> >> Any ideas what I did wrong? >> >> Thanks >> >> >> Black, Michael (IS) wrote: >>> >>> You don't need C++ wrappers...just code in C. There's lots more C >>> examples out there than C++. >>> >>> Easiest way for me to integrate is to download the amalgamation and >>> include it as a source file in your project. >>> >>> The amalgamzation is at the top of the download page: >>> >>> http://www.sqlite.org/download.html >>> >>> Simple program for you to compile as C++ which I wrote from a question >>> somebody had on the list here. >>> >>> #include <iostream> >>> #include <stdlib.h> >>> #include "sqlite3.h" >>> int main() >>> { >>> sqlite3 *db; >>> char *errmsg=NULL; >>> int rc; >>> int i; >>> sqlite3_open("test.db",&db); >>> rc=sqlite3_exec(db, "CREATE TABLE log (id_client varchar, utc >>> number)",NULL,NULL,&errmsg); >>> if (rc != SQLITE_OK) { >>> puts(errmsg); >>> sqlite3_free(errmsg); >>> } >>> sqlite3_exec(db,"BEGIN",NULL,NULL,&errmsg); >>> for(i=0;i<100000;i++) { >>> int j=i*10; >>> char sql[4096]; >>> sprintf(sql,"INSERT INTO log VALUES ('%d',%d)",i,j); >>> rc=sqlite3_exec(db, sql,NULL,NULL,&errmsg); >>> if (rc != SQLITE_OK) { >>> std::cout << errmsg << std::endl; >>> sqlite3_free(errmsg); >>> exit(-1); >>> } >>> } >>> sqlite3_exec(db,"COMMIT",NULL,NULL,&errmsg); >>> sqlite3_close(db); >>> return 0; >>> } >>> >>> >>> Michael D. Black >>> Senior Scientist >>> Northrop Grumman Mission Systems >>> >>> >>> ________________________________ >>> >>> From: sqlite-users-boun...@sqlite.org on behalf of smengl90 >>> Sent: Tue 7/6/2010 2:33 PM >>> To: sqlite-users@sqlite.org >>> Subject: EXTERNAL:[sqlite] setup sqlite in vc++ >>> >>> >>> >>> >>> Hi guys, >>> >>> I am trying to setup sqlite to be used with VC++ 2008. Can someone show >>> me >>> where I can find instructions on how to set it up? and do I need a c++ >>> wrapper to code in C++? If yes, can someone also show how to setup the >>> wrapper? >>> >>> Thanks >>> -- >>> View this message in context: >>> http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p29086729.html >>> Sent from the SQLite mailing list archive at Nabble.com. >>> >>> _______________________________________________ >>> 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 >>> >>> >> >> > > -- > View this message in context: > http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p29090562.html > Sent from the SQLite mailing list archive at Nabble.com. > > _______________________________________________ > 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