I\'m trying to get started with the C++ API for SQLite.
#include
#include
using namespace std;
int main()
{
sqlite3
First step: Install all library sqlite3 with the command:
sudo apt-get install libsqlite3-dev
With that you can use #include <sqlite3.h>
in a programm of C
or C++
.
Second step: To compile the program by console:
C++:
g++ program.cpp -o executable -lsqlite3
./executable
C:
gcc program.c -o executable -lsqlite3
./executable
You need to link the sqlite3 library along with your program:
g++ main.cpp -lsqlite3
You need to adjust your linker flags to link in the sqlite3
library. Libraries are usually installed in /usr/lib
or /usr/lib64
Alternatively, you can copy the sqlite3.c
file to your project directory and compile it as part of the g++
command:
g++ main.cpp sqlite3.c
as per: http://sqlite.org/cvstrac/wiki?p=HowToCompile
Either link your program to lib g++ yourProgram.c -lsqlite3 in command line or in Open IDE -> project -> properties -> locate lib file for sqlite3 .