/usr/bin/ld: cannot find -lboost_thread-mt

/usr/bin/ld: cannot find -lboost_thread-mt

本文关键字:-lboost thread-mt find usr bin ld cannot      更新时间:2023-10-16

我正在尝试使用以下命令链接项目:

g++  build/test.o -o bin/test -pthread -L lib  -L /home/alexander/opt/lib -lboost_thread-mt

这会导致以下错误:

/usr/bin/ld: cannot find -lboost_thread-mt
collect2: error: ld returned 1 exit status

但是,boost库安装在目录 /home/alexander/opt/lib 中。为什么链接器找不到提升库?我还尝试与-I链接,如果-L具有相同的结果......

/home/alexander/opt/lib的内容/home/alexander/opt/lib/boost_1_57_0

libboost_thread-mt更改为libboost_thread,首先找到libboost_thread.so和libboost_thread.a的地址,然后在同一地址中建立这些文件的软链接,所以它应该是:

ln -s /...libboostSourceFiles.../libboost_thread.so /..RequestTOmtFiles.../libboost_thread-mt.so

它也适用于其他 libboost -mt 文件,如序列化、iostreams、程序选项