I use netbean IDE, i was added SQLITE_HAS_CODEC=1 on project properties preprocessor defined, so i can call sqlite_key() while i’m coding but when i build i got problem.
my code
#include <cstdlib>
#include <iostream>
#include "sqlite3.h"
using namespace std;
int main(int argc, char** argv) {
return 0;
}
void test_db(void){
//INIT DATABSE
int response_code;
//open database
sqlite3 * db;
response_code = sqlite3_open("TestDB.db", &db);
response_code = sqlite3_key(db, "123", 8);
if (response_code != SQLITE_OK) {
fprintf(stderr, "Can't open database: %s\n", sqlite3_errcode(db));
return;
}
//close SQLite3 and deallocation
sqlite3_close(db);
}
my error build
g++ -c -g -DSQLITE_HAS_CODEC pkg-config --cflags sqlite3
-MMD -MP -MF “build/Debug/GNU-Linux/main.o.d” -o build/Debug/GNU-Linux/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux
g++ -o dist/Debug/GNU-Linux/cppapplication_debug build/Debug/GNU-Linux/main.o pkg-config --libs sqlite3
-lcrypto
build/Debug/GNU-Linux/main.o: In function test_db()': /run/media/electronicsengineer8/DATA/NetBeansProjects/CppApplication_Debug/main.cpp:39: undefined reference to
sqlite3_key’