dbTalk Databases Forums  

Making cxx_examples

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Making cxx_examples in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jack
 
Posts: n/a

Default Making cxx_examples - 02-22-2006 , 08:19 PM






Hi,
I have 'made install' the Berkeley DB library.
Quote:
From the dir I stored my original files, I couldn't find the
executables in that dir.
Sorry this is newbie question on BDB.
Thanks
Jack



Reply With Quote
  #2  
Old   
Jack
 
Posts: n/a

Default Re: Making cxx_examples - 02-23-2006 , 11:00 PM






The original source code from cxx_example also did not compile. What
happened?
Thanks
Jack


Reply With Quote
  #3  
Old   
Rashmi
 
Posts: n/a

Default Re: Making cxx_examples - 02-23-2006 , 11:48 PM



Hi Jack,

Let's say you are on unix, then you'd have built BDB library from the
build_unix directory using the instructions given in the documentation
(docs/index.html -> goto "Building for UNIX/POSIX systems")

Open the Makefile in build_unix and search for "Example programs for
C++". Check the name of the target for your specific example program
and build it. e.g. If you want to build excxx_example_database_load
from examples_cxx/getting_started, then use following command in
build_unix directory-
make excxx_example_database_load

Hope this helps.
Rashmi.


Reply With Quote
  #4  
Old   
Jack
 
Posts: n/a

Default Re: Making cxx_examples - 02-24-2006 , 12:06 AM



[root@localhost build_unix]# make excxx_example_database_load
/bin/sh ./libtool --mode=compile nocxx
-I../dist/../examples_cxx/getting_started -c -I. -I../dist/..
-D_GNU_SOURCE -D_REENTRANT -O
.../dist/../examples_cxx/getting_started/excxx_example_database_load.cpp
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
make: *** [excxx_example_database_load.lo] Error 1

Somethin' like this happened as well
Thanks
Jack


Reply With Quote
  #5  
Old   
Rashmi
 
Posts: n/a

Default Re: Making cxx_examples - 02-24-2006 , 04:38 AM



Do the following-

cd build_unix
../dist/configure --enable-cxx
make excxx_example_database_load

Rashmi.


Reply With Quote
  #6  
Old   
Jack
 
Posts: n/a

Default Re: Making cxx_examples - 02-24-2006 , 07:31 PM



One more dumb question. I'm just another newbie in Linux
So If I tried to compile my own project, can I just make myproject?
Thanks
Jack


Reply With Quote
  #7  
Old   
Jack
 
Posts: n/a

Default Re: Making cxx_examples - 02-24-2006 , 07:34 PM



I have got the same linking error as before when compiling standalone
project!
Thanks
Jack


Reply With Quote
  #8  
Old   
Jack
 
Posts: n/a

Default Re: Making cxx_examples - 02-26-2006 , 07:43 PM



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


Reply With Quote
  #9  
Old   
Rashmi
 
Posts: n/a

Default Re: Making cxx_examples - 02-27-2006 , 02:30 AM



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


Reply With Quote
  #10  
Old   
Jack
 
Posts: n/a

Default Re: Making cxx_examples - 02-27-2006 , 02:59 AM



Dear Rashmi,
Thank you so much. You're greatly helpful indeed, I appreciate it
Thanks
Jack


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.