Jack,
One obvious problem that I see is that you are linking with C library
instead of the C++ library. Second, I don't think you'd be getting the
exact errors that you were getting earlier. The given command will
give a lot of "undefined symbol" kind of errors.
I have this sample Makefile that I wrote to compile an independent
example outside the BDB sources (I have modified to build one of the
current examples in BDB src tree). You can have a look at it to
understand what commands are required to build your program. You may
have to modify it for your own example.
###### start makefile
INCLUDES = -I. -I/usr/local/BerkeleyDB.4.3/include
..SUFFIXES: .cpp
..cpp.o:
g++ -c -g $(INCLUDES) -D_GNU_SOURCE -D_REENTRANT -O $< -fPIC
-DPIC -o $@
SRC = SequenceExample.cpp
OBJ = $(addsuffix .o, $(basename $(SRC)))
seq_example: $(OBJ)
g++ -O -g -o $@ $(OBJ) \
-L/usr/local/BerkeleyDB.4.3/lib -ldb_cxx-4.3 \
-Wl,--rpath -Wl,/usr/local/BerkeleyDB.4.3/lib
clean:
rm seq_example $(OBJ)
###### end makefile
Hope this helps.
Rashmi.
Jack wrote:
Quote:
Hi,
Back here. After specifying the absolute path of the lib, I still got
the same errors.
I'm building my own project using
g++ -o dbx -D_REENTRANT db.cpp /usr/lib/libdb4-3.a
Thanks
Jack |