G++ ne peut pas trouver la bibliothèque boost

Je ne suis pas bon dans la ligne de commande de compilation. Mon problème est l'incapacité de la compilation d'un projet simple, cela dépend de Boost. Ce qui suit est un journal de ma tente:

$ g++ -Wall test.cpp -o main
/tmp/ccCTvBYE.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x6b): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0x77): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0x83): undefined reference to `boost::system::system_category()'
/tmp/ccCTvBYE.o: In function `boost::asio::error::get_system_category()':
test.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x5): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status

Donc, il y j'ai trouvé les instructions pour l'ajout de-lboost_system ou -lboost_system-mt. J'ai eu la suivante:

$ g++ -lboost_system -Wall test.cpp -o main                                                                                                                    
/usr/bin/ld: cannot find -lboost_system
collect2: error: ld returned 1 exit status

$ g++ -lboost_system-mt -Wall test.cpp -o main                                                                                                                 
/usr/bin/ld: cannot find -lboost_system-mt
collect2: error: ld returned 1 exit status

J'ai essayé de localiser boost_system bibliothèque.

$ /sbin/ldconfig -p | grep boost_system
    libboost_system.so.1.53.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.53.0

Ensuite, j'ai essayé, sans succès, la suite

$ g++ -I"/home/third_party/boost/" -L"/usr/lib/x86_64-linux-gnu/" -lboost_system -Wall test.cpp -o main
/usr/bin/ld: cannot find -lboost_system
collect2: error: ld returned 1 exit status

Maintenant je suis coincé. Pour la commande pour compiler?

Edit:

La suite en essayant de ne pas aider, aussi.

ln -s /usr/lib/x86_64-linux-gnu/libboost_system.so.1.53.0 /usr/lib/x86_64-linux-gnu/libboost_system.so
ldconfig -n /usr/lib/x86_64-linux-gnu/

$ ll /usr/lib/x86_64-linux-gnu/ | grep boost_system
lrwxrwxrwx   1 root root       51 янв.  21 19:47 libboost_system.so -> /usr/lib/x86_64-linux-gnu/libboost_system.so.1.53.0
-rw-r--r--   1 root root    14536 окт.  13 07:14 libboost_system.so.1.53.0

$ g++ -I"/home/third_party/boost/" -L"/usr/lib/x86_64-linux-gnu/" -lboost_system -Wall -m64 boost_async.cpp -o main
/tmp/ccE20K2W.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x6b): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0x77): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0x83): undefined reference to `boost::system::system_category()'
/tmp/ccE20K2W.o: In function `boost::asio::error::get_system_category()':
test.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x5): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status
Je vous remercie. Malheureusement, il n'a pas aidé
Essayez de placer le lien directives à la fin de la ligne de commande après le -o main partie.
Le lien de la directive est la -lMYLIB
Je n'ai pas un linux env pour vérifier, mais essayez g++ -I"/home/third_party/boost/" -L"/usr/lib/x86_64-linux-gnu/" -Wall test.cpp -o main -lboost_system(note de l' -lboost_system à la fin).
Je voulais mettre l'-lboost_system à la fin de la commande. Toutes mes excuses si ma formulation était inutile. Wesley et Colin explique mieux que je ne.

OriginalL'auteur Loom | 2014-01-21