c++ - CppDB compilation errors -
i followed following steps in order build cppdb:
svn co http://cppcms.svn.sourceforge.net/svnroot/cppcms/cppdb/trunk cppdb-trunk cd cppdb-trunk cmake ~/desktop/cppdb-trunk make make install
afterwards, i'm trying compile , run file example1.cpp examples directory.
when run gcc example1.cpp
following errors:
/tmp/ccgwenrv.o: in function
main': example1.cpp:(.text+0x2a): undefined reference to
std::allocator::allocator()' example1.cpp:(.text+0x42): undefined referencestd::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' example1.cpp:(.text+0x58): undefined reference to
cppdb::session::session(std::__cxx11::basic_string, std::allocator > const&)' example1.cpp:(.text+0x64): undefined referencestd::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' example1.cpp:(.text+0x73): undefined reference to
std::allocator::~allocator()' example1.cpp:(.text+0x91): undefined referencecppdb::session::operator<<(char const*)' example1.cpp:(.text+0xa5): undefined reference to
cppdb::statement::operator<<(void ()(cppdb::statement&))' example1.cpp:(.text+0xb4): undefined referencecppdb::statement::~statement()' example1.cpp:(.text+0xd2): undefined reference to
cppdb::session::operator<<(char const)' example1.cpp:(.text+0xe6): undefined referencecppdb::statement::operator<<(void (*)(cppdb::statement&))' example1.cpp:(.text+0xf5): undefined reference to
cppdb::statement::~statement()' example1.cpp:(.text+0x170): undefined referencecppdb::statement::statement()' example1.cpp:(.text+0x18e): undefined reference to
cppdb::session::operator<<(char const*)' example1.cpp:(.text+0x1db): undefined referencecppdb::statement::operator<<(tm const&)' example1.cpp:(.text+0x1e8): undefined reference to
cppdb::statement::operator<<(char const*)' example1.cpp:(.text+0x1fd): undefined reference `cppdb::statement::operator=(cppdb::statement const&)'
etc.
any suggestions?
try g++ example1.cpp -lcppdb
. need link against c++ run-time library (using g++
instead of gcc
takes care of that) , against cppdb (the -lcppdb
part). if gcc cannot find -lcppdb
library, you'll have provide path using -l
, , may have use ld_library_path
@ run time well.
Comments
Post a Comment