"Tinycdb 0.74" link error?
Dear all,
Does anyone have experience on tinycdb?
After I download it, and make install. It's all ok.
But I try to write a simple code to test it,
I get "undefined reference cdb_make_start,cdb_make_add and cdb_make_finish".
I check the library directory (usr/local/lib) and library file (libcdb.a),
and they are ok.
What's wrong?
Thanks for your help.
Here is my command line:
g++ -o test test.cpp -I/usr/local/include -L/usr/local/lib -lcdb
my test.cpp:
----------------------------------------------------------------------------
#include "cdb.h"
#include <cstdio>
//#include <unistd.h>
#include <fcntl.h>
#include <cstring>
using namespace std;
int main(int argc,char* argv[])
{
struct cdb_make cdbm;
int fd;
char *key="Hello";
char *val="world";
unsigned klen=strlen(key);
unsigned vlen=strlen(val);
fd = open(argv[1], O_RDWR|O_CREAT);
cdb_make_start(&cdbm, fd); /* initialize structure */
cdb_make_add(&cdbm, key, klen, val, vlen);
cdb_make_finish(&cdbm);
return 0;
}
------------------------------------------------------------------------
Regards,
cylin.
Last edited by chuanyung; 10-05-2004 at 03:09 AM.
|