Just gave it a shot
Here's the big wall of text
Code:
thread.cpp: In function ‘void wait(int)’:
thread.cpp:7:48: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
boost::this_thread::sleep_for(boost::chrono::seconds{seconds});
^
/tmp/cc7m02Rt.o: In function `__static_initialization_and_destruction_0(int, int)':
thread.cpp:(.text+0x9e): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0xaa): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0xb6): undefined reference to `boost::system::system_category()'
/tmp/cc7m02Rt.o: In function `boost::this_thread::sleep_for(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&)':
thread.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x28): undefined reference to `boost::this_thread::hidden::sleep_for(timespec const&)'
collect2: error: ld returned 1 exit status
ubuntu@ubuntu:/var/cpp/programs/test/boost$ sudo g++ -std=c++11 thread.cpp -o thread.o
/tmp/ccjzS76y.o: In function `__static_initialization_and_destruction_0(int, int)':
thread.cpp:(.text+0x9f): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0xab): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0xb7): undefined reference to `boost::system::system_category()'
/tmp/ccjzS76y.o: In function `boost::this_thread::sleep_for(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&)':
thread.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x28): undefined reference to `boost::this_thread::hidden::sleep_for(timespec const&)'
collect2: error: ld returned 1 exit status
ubuntu@ubuntu:/var/cpp/programs/test/boost$ sudo nano thread.cppubuntu@ubuntu:/var/cpp/programs/test/boost$ sudo g++ -std=c++11 thread.cpp -o thread.o
/tmp/ccjM2RCL.o: In function `__static_initialization_and_destruction_0(int, int)':
thread.cpp:(.text+0xee): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0xfa): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0x106): undefined reference to `boost::system::system_category()'
/tmp/ccjM2RCL.o: In function `boost::thread_exception::thread_exception(int, char const*)':
thread.cpp:(.text._ZN5boost16thread_exceptionC2EiPKc[_ZN5boost16thread_exceptionC5EiPKc]+0x14): undefined reference to `boost::system::system_category()'
/tmp/ccjM2RCL.o: In function `boost::detail::thread_data_base::thread_data_base()':
thread.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24): undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/ccjM2RCL.o: In function `boost::this_thread::sleep_for(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&)':
thread.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x28): undefined reference to `boost::this_thread::hidden::sleep_for(timespec const&)'
/tmp/ccjM2RCL.o: In function `boost::thread::start_thread()':
thread.cpp:(.text._ZN5boost6thread12start_threadEv[_ZN5boost6thread12start_threadEv]+0x15): undefined reference to `boost::thread::start_thread_noexcept()'
/tmp/ccjM2RCL.o: In function `boost::thread::~thread()':
thread.cpp:(.text._ZN5boost6threadD2Ev[_ZN5boost6threadD5Ev]+0x14): undefined reference to `boost::thread::detach()'
/tmp/ccjM2RCL.o: In function `boost::thread::get_id() const':
thread.cpp:(.text._ZNK5boost6thread6get_idEv[_ZNK5boost6thread6get_idEv]+0x18): undefined reference to `boost::thread::native_handle()'
/tmp/ccjM2RCL.o: In function `boost::thread::join()':
thread.cpp:(.text._ZN5boost6thread4joinEv[_ZN5boost6thread4joinEv]+0x6d): undefined reference to `boost::thread::join_noexcept()'
/tmp/ccjM2RCL.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
thread.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccjM2RCL.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[_ZTIN5boost6detail11thread_dataIPFvvEEE]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: error: ld returned 1 exit status
ubuntu@ubuntu:/var/cpp/programs/test/boost$ sudo nano thread.cppubuntu@ubuntu:/var/cpp/programs/test/boost$ sudo g++ -std=c++11 thread.cpp -o thread.o
/tmp/ccfDqou8.o: In function `__static_initialization_and_destruction_0(int, int)':
thread.cpp:(.text+0xee): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0xfa): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0x106): undefined reference to `boost::system::system_category()'
/tmp/ccfDqou8.o: In function `boost::thread_exception::thread_exception(int, char const*)':
thread.cpp:(.text._ZN5boost16thread_exceptionC2EiPKc[_ZN5boost16thread_exceptionC5EiPKc]+0x14): undefined reference to `boost::system::system_category()'
/tmp/ccfDqou8.o: In function `boost::detail::thread_data_base::thread_data_base()':
thread.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24): undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/ccfDqou8.o: In function `boost::this_thread::sleep_for(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&)':
thread.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x28): undefined reference to `boost::this_thread::hidden::sleep_for(timespec const&)'
/tmp/ccfDqou8.o: In function `boost::thread::start_thread()':
thread.cpp:(.text._ZN5boost6thread12start_threadEv[_ZN5boost6thread12start_threadEv]+0x15): undefined reference to `boost::thread::start_thread_noexcept()'
/tmp/ccfDqou8.o: In function `boost::thread::~thread()':
thread.cpp:(.text._ZN5boost6threadD2Ev[_ZN5boost6threadD5Ev]+0x14): undefined reference to `boost::thread::detach()'
/tmp/ccfDqou8.o: In function `boost::thread::get_id() const':
thread.cpp:(.text._ZNK5boost6thread6get_idEv[_ZNK5boost6thread6get_idEv]+0x18): undefined reference to `boost::thread::native_handle()'
/tmp/ccfDqou8.o: In function `boost::thread::join()':
thread.cpp:(.text._ZN5boost6thread4joinEv[_ZN5boost6thread4joinEv]+0x6d): undefined reference to `boost::thread::join_noexcept()'
/tmp/ccfDqou8.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
thread.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccfDqou8.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[_ZTIN5boost6detail11thread_dataIPFvvEEE]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: error: ld returned 1 exit status
and
Code:
/tmp/ccip21sJ.o: In function `__static_initialization_and_destruction_0(int, int)':
thread.cpp:(.text+0xee): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0xfa): undefined reference to `boost::system::generic_category()'
thread.cpp:(.text+0x106): undefined reference to `boost::system::system_category()'
/tmp/ccip21sJ.o: In function `boost::thread_exception::thread_exception(int, char const*)':
thread.cpp:(.text._ZN5boost16thread_exceptionC2EiPKc[_ZN5boost16thread_exceptionC5EiPKc]+0x14): undefined reference to `boost::system::system_category()'
/tmp/ccip21sJ.o: In function `boost::detail::thread_data_base::thread_data_base()':
thread.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24): undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/ccip21sJ.o: In function `boost::this_thread::sleep_for(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&)':
thread.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x28): undefined reference to `boost::this_thread::hidden::sleep_for(timespec const&)'
/tmp/ccip21sJ.o: In function `boost::thread::start_thread()':
thread.cpp:(.text._ZN5boost6thread12start_threadEv[_ZN5boost6thread12start_threadEv]+0x15): undefined reference to `boost::thread::start_thread_noexcept()'
/tmp/ccip21sJ.o: In function `boost::thread::~thread()':
thread.cpp:(.text._ZN5boost6threadD2Ev[_ZN5boost6threadD5Ev]+0x14): undefined reference to `boost::thread::detach()'
/tmp/ccip21sJ.o: In function `boost::thread::get_id() const':
thread.cpp:(.text._ZNK5boost6thread6get_idEv[_ZNK5boost6thread6get_idEv]+0x18): undefined reference to `boost::thread::native_handle()'
/tmp/ccip21sJ.o: In function `boost::thread::join()':
thread.cpp:(.text._ZN5boost6thread4joinEv[_ZN5boost6thread4joinEv]+0x6d): undefined reference to `boost::thread::join_noexcept()'
/tmp/ccip21sJ.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
thread.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccip21sJ.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[_ZTIN5boost6detail11thread_dataIPFvvEEE]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: error: ld returned 1 exit status
I am wondering if boost is installed properly at this point. I believe it is. This test code I got from boost.org worked first try:
Code:
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}