Eclipse中的Boost链接错误 [英] Boost linkage error in Eclipse

查看:137
本文介绍了Eclipse中的Boost链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



到目前为止的步骤:

我已经在我的Eclipse C ++项目中包含boost的线程功能。 >

从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:找不到-lboost_thread 

如下:

 调用:GCC C ++链接器
g ++ -L / usr / local / lib -oboostHello3 ./src/boostHello3.o -lboost_thread
/ usr / bin / ld:找不到-lboost_thread
collect2:ld返回1退出状态

以下是/ 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

链接器如何丢失这个?

解决方案

链接器行应该是 -lboost_thread-gcc43-mt-1_38


I've been banging my head fruitlessly against the wall attempting to include boost's thread functionality in my Eclipse C++ project on Ubuntu.

Steps so far:

Download boost from boost.org

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

sudo ldconfig -v

In the eclipse project, set the include directory to:

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

In the linker set the library(-l) to "boost_thread"

Set the search path (-L) to

/usr/local/lib

Linker runs, returns with ld error

/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:

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

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

How is the linker missing this?

解决方案

Your linker line should be saying -lboost_thread-gcc43-mt-1_38.

这篇关于Eclipse中的Boost链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆