Here is a dump
[root@localhost dbtest]# g++ -L/usr/lib -o try db.cpp -ldb4
In file included from /usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/backward/iostream.h:31,
from db.cpp:1:
/usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/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 <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
/usr/bin/ld: cannot find -ldb4
collect2: ld returned 1 exit status
[root@localhost dbtest]# g++ -L/usr/lib -o try db.cpp -ldb
In file included from /usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/backward/iostream.h:31,
from db.cpp:1:
/usr/lib/gcc/i386-redhat-linux/4.0.0/../../../../include/c++/4.0.0/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 <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
/tmp/ccSBUnso.o(.text+0x49f): In function `MyDb::MyDb(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)':
db.cpp: undefined reference to `Db:
b(DbEnv*, unsigned int)'
/tmp/ccSBUnso.o(.text+0x4d5):db.cpp: undefined reference to `Db::set_error_stream(std::basic_ostream<char, std::char_traits<char> >*)'
/tmp/ccSBUnso.o(.text+0x4ec):db.cpp: undefined reference to `Db::set_flags(unsigned int)'
/tmp/ccSBUnso.o(.text+0x522):db.cpp: undefined reference to `Db:
pen(DbTxn*, char const*, char const*, DBTYPE, unsigned int, int)'
/tmp/ccSBUnso.o(.text+0x6b5):db.cpp: undefined reference to `Db::~Db()'
/tmp/ccSBUnso.o(.text+0x6e9): In function `MyDb::MyDb(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool)':
db.cpp: undefined reference to `Db:
b(DbEnv*, unsigned int)'
/tmp/ccSBUnso.o(.text+0x71f):db.cpp: undefined reference to `Db::set_error_stream(std::basic_ostream<char, std::char_traits<char> >*)'
/tmp/ccSBUnso.o(.text+0x736):db.cpp: undefined reference to `Db::set_flags(unsigned int)'
/tmp/ccSBUnso.o(.text+0x76c):db.cpp: undefined reference to `Db:
pen(DbTxn*, char const*, char const*, DBTYPE, unsigned int, int)'
/tmp/ccSBUnso.o(.text+0x8ff):db.cpp: undefined reference to `Db::~Db()'
/tmp/ccSBUnso.o(.text+0x941): In function `__tcf_1':
db.cpp: undefined reference to `Db::~Db()'
/tmp/ccSBUnso.o(.text+0x9a8): In function `__static_initialization_and_destruction_0(int, int)':
db.cpp: undefined reference to `Db:
b(DbEnv*, unsigned int)'
/tmp/ccSBUnso.o(.gcc_except_table+0x68): undefined reference to `typeinfo for DbException'
/tmp/ccSBUnso.o(.gcc_except_table+0x9c): undefined reference to `typeinfo for DbException'
collect2: ld returned 1 exit status
Thanks xhi and other guys
Jack