Ecco un esempio di codice che non riesco a compilare.
codice:
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <db_cxx.h>
using namespace std;
int main()
{
Db db(NULL,0);
db.open(NULL,"mydb.db" ,0,DB_BTREE,DB_CREATE,0);
db.close(0);
return 0;
}
Compilando con la linea:
g++ -o ./provaBDB1 -pthread -I/usr/local/BerkeleyDB.4.3/include -L/usr/local/BerkeleyDB.4.3/lib -ldb_cxx ./provaBDB1.cpp
mi segnala i seguenti errori:
/tmp/ccXgGgYP.o: In function `main':
/tmp/ccXgGgYP.o(.text+0x12): undefined reference to `Db:
b(DbEnv *, unsigned int)'
/tmp/ccXgGgYP.o(.text+0x32): undefined reference to `Db:
pen(DbTxn *, char const *, char const *, DBTYPE, unsigned int, int)'
/tmp/ccXgGgYP.o(.text+0x43): undefined reference to `Db::close(unsigned int)'
/tmp/ccXgGgYP.o(.text+0x54): undefined reference to `Db::~Db(void)'
/tmp/ccXgGgYP.o(.text+0x6c): undefined reference to `Db::~Db(void)'
collect2: ld returned 1 exit status