i got error when i compile
undefined reference to `sqlite3_key’
#ifndef SQLITE_HAS_CODEC
#define SQLITE_HAS_CODEC 1
#endif
#ifndef SQLITE_TEMP_STORE
#define SQLITE_TEMP_STORE 2
#endif
#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”, 3);
if (response_code != SQLITE_OK) {
fprintf(stderr, “Can’t open database: %s\n”, sqlite3_errcode(db));
return;
}
//close SQLite3 and deallocation
sqlite3_close(db);
}
Hi @heriono
Please make sure you include -DSQLITE_HAS_CODEC
when you compile your application. Also, please see the introduction from more information.
i was added the cflags but still error. I see -lcrypto parameter, what mean?
this one -lcrypto from openssl?
Successfully.
Finally i did to compile my netbean project with sqlcipher, my missing is
“The Sqlcipher libs do not installed to global but /usr/local, so netbean can’t read existing libs while compiling”
i fixed with reinstalling sqlcipher with command
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto" –prefix=/usr/
make
make install
i added prefix. Now, i start journey with sqlcipher. Thank’s guy.
Hello @heriono,
That is for linking against the OpenSSL libcrypto library.
Excellent, we are happy to hear you were able to compile the library!