Reputation: 36673
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?
Upvotes: 1
Views: 3944
Reputation: 592
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. Either create an appropriate link, or use "-lboost_thread-gcc43-mt"
Upvotes: 4
Reputation: 5363
Your linker line should be saying -lboost_thread-gcc43-mt-1_38
.
Upvotes: 1