tags:

views:

420

answers:

2

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

How to remove the above error

A: 

You can be sure it starts with "libboost" and lives in ./lib/boost_1_41_0/. Something with "system" in its name might be worth trying.

ergosys
A: 

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.

R Samuel Klatchko
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 -lboost_system-mt -pthread/usr/bin/ld.real: cannot find -lboost_system-mtcollect2: ld returned 1 exit status
Mayank Jain
So what libraries do you have in lib/boost_1_41_0
Mark
I have boost_system (both as a .a and as a .so) and boost_system-mt.
R Samuel Klatchko