undefined reference to `sqlite3_open'
Hello,
I am a Linux newbie, SQLite3 newbie and C++ newbie. I have a little C++ program that I am attempting to connect to a test database. #include <iostream> using namespace std; #include <sqlite3.h> int main () { int rc; sqlite3 *db; char *zErrMsg = 0; rc = sqlite3_open( "DBm", & db); if (rc) { cout << "faileure to open database "; cout << endl; } } When I compile this code, I get the error: undefined reference to `sqlite3_open' I added sqlite3 package using the command 'apt-get install sqlite3'. Unfortunately the sqlite3.h header file was not installed in /usr/include, so I downloaded the SQLite3 dist., untarred it and copied the sqlite3.h file to /usr/include. I saw on a previous message that I would need to link the library. The only library file in /usr/lib is libsqlite3.so.0, so the command g++ -lsqlite3 still gives me an error. Any help is appreciated. I am stabbing in the dark here. |
apt-get install libsqlite3-dev ?
Also, it would be nice if you told us what Linux distro you are using. |
Distro
Quote:
|
Did it solve your problem?
|
problem solved
Yes, thank you! It worked like a charm! I will probably be submitting more questions as I go - you guys are great!
|
I wonder, is it possible to use sqlite in the same way, but without installing in system, just by including required libs.
if it's possible, then how to do it? Thanks. |
can u Help me out iam also having same issue
Quote:
|
Quote:
|
All times are GMT -5. The time now is 01:18 AM. |