ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am using RedHat Linux 2.6.9-1.667smp on a standard intel desktop and I've written a simple little test program to prove that dbopen works and I just
can't get it to compile properly. I really need help with this one as I'm stuck.
The error message I get is as follows,
cc -g -I/usr/include -c dbtest.c -o dbtest.o
dbtest.c: In function `main':
dbtest.c:14: error: `RECNOINFO' undeclared (first use in this function)
dbtest.c:14: error: (Each undeclared identifier is reported only once
dbtest.c:14: error: for each function it appears in.)
dbtest.c:14: error: syntax error before "rec"
dbtest.c:17: error: `rec' undeclared (first use in this function)
dbtest.c:17: error: `R_FIXEDLEN' undeclared (first use in this function)
dbtest.c:26: warning: assignment makes pointer from integer without a cast
cons: *** [dbtest.o] Error 1
cons: errors constructing dbtest.o
the program is as follows.
rec.flags = R_FIXEDLEN;
rec.cachesize=0; /* use default cachesize */
rec.psize = 0; /* Let system select page size. */
rec.lorder = 0; /* Use current Host ordering. */
rec.reclen = 20;/* 20 byte record length */
rec.bval = '\0';/* Padding char used when fixed length. */
rec.bfname= NULL; /* Don't need to know about internal b-tree. */
the dbm libraries appear to be part of the GNU db libraries rather than the db libraries. All the examples I have found on the internet for dbopen indicate that I should be using <db.h> and setting my pointer as a DB *ptr.
I have found references to RECNOINFO and the other missing defintions in db_185.h - but I don't know what that is or whether I should be using it.
I believe when Berkeley DB is built it automaticaly includes db-1.8.5
compatability. So u must be using BerkeleyDB version 2 or higher. Their
file formats change as often as their underware. If u build DB yourself u
can use a command line switch in the configure file to shut it off. So if u
write any code using db-1,8,5 calls u must include db_185.h. I'm sure if
i'm wrong someone on here will let me know.