Ok, I did just that, but now I get errors when compiling, all related to the malloc operations.
1>Compiling... 1>TestSqlite.cpp 1>c:\documents and settings\las1pal\my documents\visual studio 2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot convert from 'void *' to 'char *' 1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast 1>c:\documents and settings\las1pal\my documents\visual studio 2008\projects\sqlite3\sqlite3.c(12975) : error C2440: '=' : cannot convert from 'void *' to 'sqlite3_int64 *' 1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast 1>c:\documents and settings\las1pal\my documents\visual studio 2008\projects\sqlite3\sqlite3.c(13028) : error C2440: '=' : cannot convert from 'void *' to 'sqlite3_int64 *' 1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast 1>c:\documents and settings\las1pal\my documents\visual studio 2008\projects\sqlite3\sqlite3.c(15959) : error C2440: '=' : cannot convert from 'void *' to 'sqlite3_mutex *' 1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast ....... Is it because I include a .c source file in a c++ project? Thanks Black, Michael (IS) wrote: > > You don't need the lib -- you just need to include sqlite3.c as another > source file in your project. > > Michael D. Black > Senior Scientist > Northrop Grumman Mission Systems > > > ________________________________ > > From: sqlite-users-boun...@sqlite.org on behalf of smengl90 > Sent: Tue 7/6/2010 5:09 PM > To: sqlite-users@sqlite.org > Subject: EXTERNAL:Re: [sqlite] EXTERNAL: setup sqlite in vc++ > > > > > 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 > > -- View this message in context: http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p29098893.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