Reputation: 44345
I am trying to link a project with the following command:
g++ build/test.o -o bin/test -pthread -L lib -L /home/alexander/opt/lib -lboost_thread-mt
which results in the following errors:
/usr/bin/ld: cannot find -lboost_thread-mt
collect2: error: ld returned 1 exit status
However, the boost
libraries are installed in the directory /home/alexander/opt/lib
. Why does the linker do not find the boost libraries? I also tried to link with -I
instead if -L
with the same outcome...
Content of /home/alexander/opt/lib
is /home/alexander/opt/lib/boost_1_57_0
.
Upvotes: 2
Views: 8256
Reputation: 29
change libboost_thread-mt to libboost_thread, first find the address of libboost_thread.so and libboost_thread.a then make softlinks to these files in the same address, so it should be:
ln -s /...libboostSourceFiles.../libboost_thread.so /..RequestTOmtFiles.../libboost_thread-mt.so
it works for other libboost -mt files too, like serialization , iostreams, programoptions
Upvotes: 1