at first I tried "gcc example.cpp -o example -lboost_thread" which resulted in the following error:
/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
I tried this and finally it worked: "gcc example.cpp -o example -L /root/boost_1_53_0/stage/lib/ -lboost_thread -lboost_system"
I added the "/root/boost_1_53_0/stage/lib/" to Eclipse "Library Paths" on the project properties under the "C/C++ General" section and also added "boost_thread", "boost_system" , "boost_regex" and "boost_date_time" to "Libraries" on the same section. after building and compiling the undefined reference error for "boost::this_thread::disable_interruption" was removed but I received two new errors. one of them is:
/usr/include/boost/thread/detail/thread.hpp:191: undefined reference to `boost::thread::start_thread()'
and the other is:
/root/workspace/AMI2/Debug/../src/manager/ManagerEventsHandler.cpp:46: undefined reference to `boost::thread::~thread()'
in the following piece of code:
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <string.h>
void ManagerEventsHandler::fireEvent(const ManagerEvent& me) {
boost::thread t(boost::bind(&ManagerEventsHandler::internalFireEvent, this, me));
}
Given that I have included "boost/thread.hpp" in the source code and included the boost::thread library path and binaries in the project, what else should I do?
Mostafa I reviewed compiler options and I think I'm using them correctly. are there any flaws?
Nat thanks for the link. it was very helpful.