在boost中编译简单代码时出错。如何找到图书馆的名称?

时间:2010-01-30 07:04:47

标签: boost g++

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:315: 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

如何删除上述错误

1 个答案:

答案 0 :(得分:1)

您想要-lboost_system

Boost构建系统构建单个库的多个变体。例如,该库的线程安全版本为-lboost_system-mt。要了解变体的命名方式,请参阅Boost documentation