Boost logo

Boost Users :

Subject: [Boost-users] boost:thread compiling problem
From: Shaolin (shaolinfinest_at_[hidden])
Date: 2009-08-20 19:55:51


Hi Guys

I am try to create a thread with boost but eveytime I execute I get some
freaky error messages. See code below followed by error msg:

#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std;

void hello()
{
    cout << "hello" << endl;
}

int main(int argc, char* argv[])
{
    boost::thread thrd1(&hello); // ERROR caused by the &hello param
    thrd1.join();

}

*Error Message*:

/tmp/cc3ymRwv.o: In function `main':
main.cc:(.text+0x417): undefined reference to `boost::thread::join()'
main.cc:(.text+0x422): undefined reference to `boost::thread::~thread()'
main.cc:(.text+0x43b): undefined reference to `boost::thread::~thread()'
/tmp/cc3ymRwv.o: In function `boost::mutex::mutex()':
main.cc:(.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x45): undefined
reference to `boost::thread_resource_error::thread_resource_error()'
main.cc:(.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x4d): undefined
reference to `boost::thread_resource_error::~thread_resource_error()'
main.cc:(.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x55): undefined
reference to `typeinfo for boost::thread_resource_error'
/tmp/cc3ymRwv.o: In function `boost::detail::thread_data<void
(*)()>::~thread_data()':
main.cc:(.text._ZN5boost6detail11thread_dataIPFvvEED0Ev[boost::detail::thread_data<void
(*)()>::~thread_data()]+0x16): undefined reference to
`boost::detail::thread_data_base::~thread_data_base()'
/tmp/cc3ymRwv.o: In function `boost::detail::thread_data<void
(*)()>::~thread_data()':
main.cc:(.text._ZN5boost6detail11thread_dataIPFvvEED1Ev[boost::detail::thread_data<void
(*)()>::~thread_data()]+0x16): undefined reference to
`boost::detail::thread_data_base::~thread_data_base()'
/tmp/cc3ymRwv.o: In function
`boost::condition_variable::condition_variable()':
main.cc:(.text._ZN5boost18condition_variableC1Ev[boost::condition_variable::condition_variable()]+0x3a):
undefined reference to
`boost::thread_resource_error::thread_resource_error()'
main.cc:(.text._ZN5boost18condition_variableC1Ev[boost::condition_variable::condition_variable()]+0x42):
undefined reference to
`boost::thread_resource_error::~thread_resource_error()'
main.cc:(.text._ZN5boost18condition_variableC1Ev[boost::condition_variable::condition_variable()]+0x4a):
undefined reference to `typeinfo for boost::thread_resource_error'
/tmp/cc3ymRwv.o: In function
`boost::detail::thread_data_base::thread_data_base()':
main.cc:(.text._ZN5boost6detail16thread_data_baseC2Ev[boost::detail::thread_data_base::thread_data_base()]+0x1b):
undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/cc3ymRwv.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)':
main.cc:(.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/cc3ymRwv.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo
for boost::detail::thread_data<void (*)()>]+0x8): undefined reference to
`typeinfo for boost::detail::thread_data_base'
collect2: ld returned 1 exit status



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net