http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/example/allocation/server.cpp
g++ -L./lib/boost_1_41_0/ -L./lib/soci-3.0.0/ -L/usr/lib/ -L/usr/local/lib/ -L./ -I/usr/include -I./lib/boost_1_41_0 -o main server.o -lssl -pthread
server.o: In function `error_code':
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:315: undefined reference to `boost::system::get_system_category()'
server.o: In function `get_system_category':
/test/mycode/./lib/boost_1_41_0/boost/asio/error.hpp:218: undefined reference to `boost::system::get_system_category()'
server.o: In function `error_code':
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:315: undefined reference to `boost::system::get_system_category()'
server.o: In function `__static_initialization_and_destruction_0':
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:208: undefined reference to `boost::system::get_system_category()'
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:209: undefined reference to `boost::system::get_generic_category()'
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:214: undefined reference to `boost::system::get_generic_category()'
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:215: undefined reference to `boost::system::get_generic_category()'
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:216: undefined reference to `boost::system::get_system_category()'
server.o: In function `error_code':
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:315: undefined reference to `boost::system::get_system_category()'
server.o: In function `get_system_category':
/test/mycode/./lib/boost_1_41_0/boost/asio/error.hpp:218: undefined reference to `boost::system::get_system_category()'
server.o: In function `error_code':
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:3开发者_C百科15: undefined reference to `boost::system::get_system_category()'
/test/mycode/./lib/boost_1_41_0/boost/system/error_code.hpp:315: undefined reference to `boost::system::get_system_category()'
server.o:/test/mycode/./lib/boost_1_41_0/boost/asio/error.hpp:218: more undefined references to `boost::system::get_system_category()' follow
collect2: ld returned 1 exit status
make: *** [main] Error 1
How to remove the above error
You want -lboost_system
.
The Boost build system builds multiple variants of a single library. For example, a thread safe version of that library is -lboost_system-mt
. To understand how the variants are named, see the Boost documentation.
精彩评论