+ Reply to Thread
Results 1 to 4 of 4

undefined reference to Db::Db()

  1. undefined reference to Db::Db()

    I am a newbie to the Berkeley DB. I am getting this error when I try to
    produce my outfile for a very simple C++ example file.

    Here are my steps:
    I am working on the latest version of RedHat;
    I did the following to build the DB on my laptop:
    From build_unix dir I did
    [root@localhost build_unix]# make realclean
    [root@localhost build_unix]# ../dist/configure --enable-cxx
    [root@localhost build_unix]# make
    [root@localhost build_unix]# make install

    Here is my Berkeley Dir file listings:
    db_archive db_deadlock db_hotbackup db_printlog db_stat
    db_checkpoint db_dump db_load db_recover db_upgrade

    db_cxx.h db.h

    libdb-4.4.a libdb-4.4.so libdb.a
    libdb-4.4.la libdb-4.so libdb.so
    libdb_cxx-4.so libdb_cxx.so libdb_cxx-4.4.la
    libdb_cxx-4.4.a libdb_cxx-4.4.so

    Here is my program:

    using namespace std;

    int main(){
    return (0);

    Here are the commands I ran:

    [root@localhost mydb]# g++ -c -I/usr/local/BerkeleyDB.4.4/include/
    [no problem]

    [root@localhost mydb]# g++ -o ciboreqt SearchThread.o


    SearchThread.o(.text+0x28): In function `main':
    SearchThread.cpp: undefined reference to `Db:b(DbEnv*, unsigned int)'
    SearchThread.o(.text+0x37):SearchThread.cpp: undefined reference to
    collect2: ld returned 1 exit status
    [root@localhost mydb]#

    The program is so simple and the concept is the same as any other
    program, that I don't understand what the problem is with the linker.


  2. Re: undefined reference to Db::Db()

    Try something like:
    -L/usr/local/BerkeleyDB.4.4/lib/ -ldb_cxx-4.4


  3. Re: undefined reference to Db::Db()

    That worked, however, when I execute my outfile it gives me the error

    ../cibyre : error while loading shared libraries: libdb_cxx-4.4.so:
    cannot open shared object file: No such file or directory

    Any ideas on this one?

  4. Re: undefined reference to Db::Db()

    You can add the lib directory to the LD_LIBRARY_PATH environment variable, let the system know where to find dynamic library files.

    However, is there a way to statically link with C++ support?

+ Reply to Thread