Hi All,
sorry if this is the wrong newsgroup - if so please let me know. But in case
it's not - here's my problem.
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
really 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.
------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <db.h>
main()
{
DB *ptr;
RECNOINFO rec;
char *fname="test.dat";
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. */
ptr = dbopen( fname,(int) O_CREAT|O_EXCL|O_RDWR,(int) S_IWRITE|S_IREAD,
DB_RECNO, (const void *) &rec );
}