简体   繁体   English

增强Eclipse中的链接错误

[英]Boost linkage error in Eclipse

I've been banging my head fruitlessly against the wall attempting to include boost's thread functionality in my Eclipse C++ project on Ubuntu. 我一直不知所措,试图在Ubuntu上的Eclipse C ++项目中加入boost的线程功能。

Steps so far: 到目前为止的步骤:

Download boost from boost.org 从boost.org下载boost

./configure --with-libraries=system,thread
make
sudo make install

sudo ldconfig -v

In the eclipse project, set the include directory to: 在eclipse项目中,将include目录设置为:

/usr/local/include/boost-1_38/

In the linker set the library(-l) to "boost_thread" 在链接器中,将库(-l)设置为“ boost_thread”

Set the search path (-L) to 将搜索路径(-L)设置为

/usr/local/lib

Linker runs, returns with ld error 链接器运行,返回ld错误

/usr/bin/ld: cannot find -lboost_thread

as follows: 如下:

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

Here are relevant entries from /usr/local/lib: 以下是/ 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

Here are the contents of /etc/ld.so.conf 这是/etc/ld.so.conf的内容

include /etc/ld.so.conf.d/*.conf
/usr/local/lib

How is the linker missing this? 链接器如何丢失此信息?

Well, the linker tries to find a library called "libboost_thread.a" (or "libboost_thread.so") in its search path, which you apparently don't have. 很好,链接器尝试在其搜索路径中找到一个名为“ libboost_thread.a”(或“ libboost_thread.so”)的库,您显然没有该库。 Either create an appropriate link, or use "-lboost_thread-gcc43-mt" 创建适当的链接,或使用“ -lboost_thread-gcc43-mt”

您的链接器行应该说-lboost_thread-gcc43-mt-1_38

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM