LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author] [stats]
  From: David Lloyd <lloy0076@rebel.net.au>
  To  : <linuxsa@linuxsa.org.au>
  Date: Mon, 30 Jul 2001 14:45:43 +0930

Compiling Berkeley DB Programs

Hi There!

I've got a full version of RedHat 7.1 installed.

I'm trying to compile this:

#include <stdio.h>
#include <sys/types.h>
#include <db.h>

int main() {
	DB *dbp;

	int t_ret, ret;
	
	if ((ret=db_create(&dbp, NULL, 0) != 0)) {
		fprintf(stderr, "db_create: %s\n", db_strerror(ret));
		exit(1);	
	}

	if ((ret=dbp->open(dbp, "vote", "vote.db", DB_RECNO, DB_CREATE, 0664)
!= 0)) {
		dbp->err(dbp, ret, "vote.db");
		goto err;
	}

err:
	if ((t_ret=dbp->close(dbp, 0) != 0) && (ret == 0)) {
		ret=t_ret;
	}

	exit(ret);
}

But I get:

[lloy0076@localhost voting]$ make
gcc -o vote -O2 -march=athlon -L /lib -l lib/libdb-3.1.so vote.o
gcc: lib/libdb-3.1.so: No such file or directory
make: *** [vote] Error 1

I've tried /usr/lib and various other combinations.

I can't quite work out what to use, sleepycat's home page doesn't have
it on the FAQ, I have the New Riders Berkeley DB Book but it doesn't
tell you how to LINK with the actual library and I can't find any
information on the Internet specific to my problem.

What flags do I need (I suspect it's a combination of -I and -l with
various locations/files) to link against DB3.1?

DSL

-- 
LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author] [stats]
Return to the LinuxSA Mailing List Information Page