Created
September 10, 2014 21:25
-
-
Save n-west/5ccd625b92443bab8d87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/thread.hpp> | |
void workerFunc() | |
{ | |
std::cout << "Worker: running" << std::endl; | |
std::cout << "Worker: finished" << std::endl; | |
} | |
int main(int argc, char* argv[]) | |
{ | |
std::cout << "main: startup" << std::endl; | |
boost::thread workerThread(workerFunc); | |
std::cout << "main: waiting for thread" << std::endl; | |
workerThread.join(); | |
std::cout << "main: done" << std::endl; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nathan@vanilla:/opt/code/sandbox/threads $ g++ -lboost_thread -lboost_system bthread.cc | |
/tmp/ccf6LGdy.o: In function `__static_initialization_and_destruction_0(int, int)': | |
bthread.cc:(.text+0x13e): undefined reference to `boost::system::generic_category()' | |
bthread.cc:(.text+0x14a): undefined reference to `boost::system::generic_category()' | |
bthread.cc:(.text+0x156): undefined reference to `boost::system::system_category()' | |
/tmp/ccf6LGdy.o: In function `boost::thread_exception::thread_exception(int, char const*)': | |
bthread.cc:(.text._ZN5boost16thread_exceptionC2EiPKc[_ZN5boost16thread_exceptionC5EiPKc]+0x14): undefined reference to `boost::system::system_category()' | |
/tmp/ccf6LGdy.o: In function `boost::detail::thread_data_base::thread_data_base()': | |
bthread.cc:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24): undefined reference to `vtable for boost::detail::thread_data_base' | |
/tmp/ccf6LGdy.o: In function `boost::thread::start_thread()': | |
bthread.cc:(.text._ZN5boost6thread12start_threadEv[_ZN5boost6thread12start_threadEv]+0x15): undefined reference to `boost::thread::start_thread_noexcept()' | |
/tmp/ccf6LGdy.o: In function `boost::thread::~thread()': | |
bthread.cc:(.text._ZN5boost6threadD2Ev[_ZN5boost6threadD5Ev]+0x15): undefined reference to `boost::thread::detach()' | |
/tmp/ccf6LGdy.o: In function `boost::thread::get_id() const': | |
bthread.cc:(.text._ZNK5boost6thread6get_idEv[_ZNK5boost6thread6get_idEv]+0x18): undefined reference to `boost::thread::native_handle()' | |
/tmp/ccf6LGdy.o: In function `boost::thread::join()': | |
bthread.cc:(.text._ZN5boost6thread4joinEv[_ZN5boost6thread4joinEv]+0x6d): undefined reference to `boost::thread::join_noexcept()' | |
/tmp/ccf6LGdy.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()': | |
bthread.cc:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()' | |
/tmp/ccf6LGdy.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[_ZTIN5boost6detail11thread_dataIPFvvEEE]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base' | |
collect2: error: ld returned 1 exit status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment