Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > C++ strange linking errors
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 21st April 00:11
ugo.matrangolo
External User
 
Posts: 1
Default C++ strange linking errors


Hi,

I'm a Berkeley-DB newbie (tried this morning).

I tried the c version of the berkeley-db software with success but i
cannot compile the same c++ version of the c code.

I tried to compile the examples in the example_cxx dir of the bdb
distribution but i get the same strange errors.

In the above dir, when i do a :
matra@nyx:~/software/berkeleydb/db-4.2.52.NC/examples_cxx> g++
-I/usr/local/BerkeleyDB.4.2/include Acces***ample.cpp

i get :
In file included from /usr/include/g++/backward/iostream.h:31,
from /usr/local/BerkeleyDB.4.2/include/db_cxx.h:59,
from Acces***ample.cpp:27:
/usr/include/g++/backward/backward_warning.h:32:2: warning: #warning
This file includes at least one deprecated or antiquated header.
Please consider using one of the 32 headers found in section 17.4.1.2
of the C++ standard. Examples include substituting the <X> header for
the <X.h> header for C++ includes, or <sstream> instead of the
deprecated header <strstream.h>. To disable this warning use
-Wno-deprecated.
/tmp/ccZrcaAb.o(.text+0x1cf): In function `Acces***ample::run(bool,
char const*)':
: undefined reference to `Db:b[in-charge](DbEnv*, unsigned)'
/tmp/ccZrcaAb.o(.text+0x1e3): In function `Acces***ample::run(bool,
char const*)':
: undefined reference to
`Db::set_error_stream(std::basic_ostream<char, std::char_traits<char>

/tmp/ccZrcaAb.o(.text+0x1f7): In function `Acces***ample::run(bool,
char const*)':
: undefined reference to `Db::set_errpfx(char const*)'
/tmp/ccZrcaAb.o(.text+0x20b): In function `Acces***ample::run(bool,
char const*)':
: undefined reference to `Db::set_pagesize(unsigned)'
/tmp/ccZrcaAb.o(.text+0x220): In function `Acces***ample::run(bool,
char const*)':
: undefined reference to `Db::set_cachesize(unsigned, unsigned, int)'
/tmp/ccZrcaAb.o(.text+0x23f): In function `Acces***ample::run(bool,
char const*)':
: undefined reference to `Db:pen(DbTxn*, char const*, char const*,
DBTYPE, unsigned, int)'
/tmp/ccZrcaAb.o(.text+0x342): In function `Acces***ample::run(bool,
char const*)':
: u ... and so on!

I cannot understand the "[in-charge]" string!

Please help me!

Thank you in advance for any reply.

Bye!
  Reply With Quote


  sponsored links


2 21st April 00:12
mjc
External User
 
Posts: 1
Default C++ strange linking errors


Hi Ugo,

My name is Michael Cahill from Sleepycat Software.


The main problem here is that you are telling g++ to compile and link
an application, but you aren't including the Berkeley DB C++ library
for the link. Something like this should work better:

g++ -c -I/usr/local/BerkeleyDB.4.2/include Acces***ample.cpp
g++ -o Acces***ample Acces***ample.o \
-L/usr/local/BerkeleyDB4.2 -ldb_cxx-4.2

Alternatively, you can build this using our Makefile, with this
command in the build directory:
make excxx_access


This warning is odd -- with g++, you should see the line "#define
HAVE_CXX_STDHEADERS 1" in db_cxx.h, so <iostream> should be included
rather than <iostream.h>. Is it possible that you configured with a
different compiler, or a different version of g++? (In particular, is
the "c++" command the same as "g++" on your system?)


This and all following messages are just a symptom of the missing
library.

Regards,
Michael.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666