« Return to Thread: Posix Thread

Posix Thread

by hosseinyounesi :: Rate this Message:

Reply to Author | View in Thread

Hi , this is the first time I post a message on this forum. I tried to compile the thread example in the site with g++ and got this error :(    What should I do ?

/tmp/ccPU0lRI.o: In function `__static_initialization_and_destruction_0(int, int
)':
thread.cpp:(.text+0x151): undefined reference to `boost::mutex::mutex()'
/tmp/ccPU0lRI.o: In function `__tcf_1':
thread.cpp:(.text+0x19e): undefined reference to `boost::mutex::~mutex()'
/tmp/ccPU0lRI.o: In function `main':
thread.cpp:(.text+0x205): undefined reference to `boost::thread::thread(boost::f
unction0<void, std::allocator<boost::function_base> > const&)'
thread.cpp:(.text+0x24f): undefined reference to `boost::thread::thread(boost::f
unction0<void, std::allocator<boost::function_base> > const&)'
thread.cpp:(.text+0x29e): undefined reference to `boost::thread::join()'
thread.cpp:(.text+0x2a9): undefined reference to `boost::thread::join()'
thread.cpp:(.text+0x2bb): undefined reference to `boost::thread::~thread()'
thread.cpp:(.text+0x2ce): undefined reference to `boost::thread::~thread()'
thread.cpp:(.text+0x2de): undefined reference to `boost::thread::~thread()'
thread.cpp:(.text+0x2f7): undefined reference to `boost::thread::~thread()'
/tmp/ccPU0lRI.o: In function `boost::detail::thread::lock_ops<boost::mutex>::loc
k(boost::mutex&)':
thread.cpp:(.text._ZN5boost6detail6thread8lock_opsINS_5mutexEE4lockERS3_[boost::
detail::thread::lock_ops<boost::mutex>::lock(boost::mutex&)]+0xd): undefined ref
erence to `boost::mutex::do_lock()'
/tmp/ccPU0lRI.o: In function `boost::detail::thread::scoped_lock<boost::mutex>::
lock()':
thread.cpp:(.text._ZN5boost6detail6thread11scoped_lockINS_5mutexEE4lockEv[boost:
:detail::thread::scoped_lock<boost::mutex>::lock()]+0x28): undefined reference t
o `boost::lock_error::lock_error()'
thread.cpp:(.text._ZN5boost6detail6thread11scoped_lockINS_5mutexEE4lockEv[boost:                                                                            :detail::thread::scoped_lock<boost::mutex>::lock()]+0x30): undefined reference t                                                                            o `boost::lock_error::~lock_error()'
thread.cpp:(.text._ZN5boost6detail6thread11scoped_lockINS_5mutexEE4lockEv[boost:                                                                            :detail::thread::scoped_lock<boost::mutex>::lock()]+0x38): undefined reference t                                                                            o `typeinfo for boost::lock_error'
/tmp/ccPU0lRI.o: In function `boost::detail::thread::lock_ops<boost::mutex>::unl                                                                            ock(boost::mutex&)':
thread.cpp:(.text._ZN5boost6detail6thread8lock_opsINS_5mutexEE6unlockERS3_[boost                                                                            ::detail::thread::lock_ops<boost::mutex>::unlock(boost::mutex&)]+0xd): undefined                                                                             reference to `boost::mutex::do_unlock()'
/tmp/ccPU0lRI.o: In function `boost::detail::thread::scoped_lock<boost::mutex>::                                                                            unlock()':
thread.cpp:(.text._ZN5boost6detail6thread11scoped_lockINS_5mutexEE6unlockEv[boos                                                                            t::detail::thread::scoped_lock<boost::mutex>::unlock()]+0x2b): undefined referen                                                                            ce to `boost::lock_error::lock_error()'
thread.cpp:(.text._ZN5boost6detail6thread11scoped_lockINS_5mutexEE6unlockEv[boos                                                                            t::detail::thread::scoped_lock<boost::mutex>::unlock()]+0x33): undefined referen                                                                            ce to `boost::lock_error::~lock_error()'
thread.cpp:(.text._ZN5boost6detail6thread11scoped_lockINS_5mutexEE6unlockEv[boos                                                                            t::detail::thread::scoped_lock<boost::mutex>::unlock()]+0x3b): undefined referen                                                                            ce to `typeinfo for boost::lock_error'
collect2: ld returned 1 exit status

 « Return to Thread: Posix Thread