I followed the above script. Now the header are in /usr/local/include and the builded libraries in /usr/local/lib. I tired to compile the example in test.cpp:
Code:
#include <boost/thread.hpp>
#include <iostream>
void wait(int seconds)
{
boost::this_thread::sleep(boost::posix_time::seconds(seconds));
}
void thread()
{
for (int i = 0; i < 5; ++i)
{
wait(1);
std::cout << i << std::endl;
}
}
int main()
{
boost::thread t(thread);
t.join();
}
For compiling I use
g++ test.cpp -otest
I get the following error messages:
Code:
test.cpp:(.text+0x9f): undefined reference to `boost::thread::join()'
test.cpp:(.text+0xab): undefined reference to `boost::thread::~thread()'
test.cpp:(.text+0xca): undefined reference to `boost::thread::~thread()'
/tmp/ccNPcdEE.o: In function `boost::detail::thread_data_base::thread_data_base()':
test.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[boost::detail::thread_data_base::thread_data_base()]+0x26): undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/ccNPcdEE.o: In function `void boost::this_thread::sleep<boost::posix_time::seconds>(boost::posix_time::seconds const&)':
test.cpp:(.text._ZN5boost11this_thread5sleepINS_10posix_time7secondsEEEvRKT_[void boost::this_thread::sleep<boost::posix_time::seconds>(boost::posix_time::seconds const&)]+0x35): undefined reference to `boost::this_thread::sleep(boost::posix_time::ptime const&)'
/tmp/ccNPcdEE.o: In function `boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type)':
test.cpp:(.text._ZN5boost6threadC1IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type)]+0x32): undefined reference to `boost::thread::start_thread()'
/tmp/ccNPcdEE.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
test.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED1Ev[boost::detail::thread_data<void (*)()>::~thread_data()]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccNPcdEE.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
test.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED0Ev[boost::detail::thread_data<void (*)()>::~thread_data()]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccNPcdEE.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo for boost::detail::thread_data<void (*)()>]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: ld returned 1 exit status
Does anybody know, where the mistake is?
Regards
Bookmarks