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 tostd::allocator::allocator()' example1.cpp:(.text+0x42): undefined reference std::__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 tocppdb::session::session(std::__cxx11::basic_string, std::allocator > const&)' example1.cpp:(.text+0x64): undefined reference std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' example1.cpp:(.text+0x73): undefined reference tostd::allocator::~allocator()' example1.cpp:(.text+0x91): undefined reference cppdb::session::operator<<(char const*)' example1.cpp:(.text+0xa5): undefined reference tocppdb::statement::operator<<(void ()(cppdb::statement&))' example1.cpp:(.text+0xb4): undefined reference cppdb::statement::~statement()' example1.cpp:(.text+0xd2): undefined reference tocppdb::session::operator<<(char const)' example1.cpp:(.text+0xe6): undefined reference cppdb::statement::operator<<(void (*)(cppdb::statement&))' example1.cpp:(.text+0xf5): undefined reference tocppdb::statement::~statement()' example1.cpp:(.text+0x170): undefined reference cppdb::statement::statement()' example1.cpp:(.text+0x18e): undefined reference tocppdb::session::operator<<(char const*)' example1.cpp:(.text+0x1db): undefined reference cppdb::statement::operator<<(tm const&)' example1.cpp:(.text+0x1e8): undefined reference tocppdb::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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -