Boost logo

Threads-Devel :

From: Rij (rij.ghosh_at_[hidden])
Date: 2007-11-20 13:44:57


Hello,

I am trying to use Boost Thread libraries. I followed the usual
download and build instructions.

So now I have all my Thread header files in:
.../boost_1_34_1/boost/thread/

I have the following libraries in .../boost_1_34_1/stage/lib:
libboost_thread-gcc34-mt-1_34_1.a libboost_thread-gcc34-mt-d.a
libboost_thread-gcc34-mt-d-1_34_1.a libboost_thread-gcc34-mt.a

Now I am trying to compile the standard hello world which looks like this:
#include <boost/thread/thread.hpp>
#include <iostream>

void hello() {
std::cout << "Hello world, I'm a thread!" << std::endl;
}

int main(int argc, char* argv[]) {
boost::thread thrd(&hello);
thrd.join();
return 0;
}

I compile with gcc 3.4.1 on SunOS. I specified the header files with
-I option and the libraries with -L option.

But ld is unable to resolve the thread symbols. So I get the error:

Undefined first referenced
symbol in file
boost::thread::join() /var/tmp//ccrK5p0W.o
boost::thread::~thread() /var/tmp//ccrK5p0W.o
boost::thread::thread(boost::function0<void,
std::allocator<boost::function_base> > const&)/var/tmp//ccrK5p0W.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Can someone please help?


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk