我一直在尝试将 boost 的线程功能包含在 Ubuntu 上的 Eclipse C++ 项目中,但毫无结果。
到目前为止的步骤:
从 boost.org 下载 boost
./configure --with-libraries=system,thread
make
sudo make install
sudo ldconfig -v
在eclipse项目中,将include目录设置为:
/usr/local/include/boost-1_38/
在链接器中将库(-l)设置为“boost_thread”
将搜索路径 (-L) 设置为
/usr/local/lib
链接器运行,返回 ld 错误
/usr/bin/ld: cannot find -lboost_thread
如下:
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o"boostHello3" ./src/boostHello3.o -lboost_thread
/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
以下是 /usr/local/lib 中的相关条目:
libboost_system-gcc43-mt-1_38.a
libboost_system-gcc43-mt-1_38.so
libboost_system-gcc43-mt-1_38.so.1.38.0
libboost_system-gcc43-mt.a
libboost_system-gcc43-mt.so
libboost_thread-gcc43-mt-1_38.a
libboost_thread-gcc43-mt-1_38.so
libboost_thread-gcc43-mt-1_38.so.1.38.0
libboost_thread-gcc43-mt.a
libboost_thread-gcc43-mt.so
这是/etc/ld.so.conf的内容
include /etc/ld.so.conf.d/*.conf
/usr/local/lib
链接器怎么会缺少这个?