2010-01-30 8 views
1

http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/example/allocation/server.cppErreur lors de la compilation du code simple dans boost. Comment trouver le nom de la bibliothèque?

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 

Comment supprimer l'erreur ci-dessus

Répondre

1

Vous voulez -lboost_system.

Le système de génération Boost génère plusieurs variantes d'une seule bibliothèque. Par exemple, une version thread-safe de cette bibliothèque est -lboost_system-mt. Pour comprendre comment les variantes sont nommées, voir le Boost documentation.

+0

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 serveur principal.o -lssl -lboost_system -mt -pthread /usr/bin/ld.real: impossible de trouver -lboost_system-mt collect2: ld a renvoyé 1 statut de sortie –

+0

Alors que font les bibliothèques? Vous avez lib/boost_1_41_0 – Mark

+0

J'ai boost_system (à la fois en .a et en .so) et boost_system-mt. –

Questions connexes