Boost logo

Threads-Devel :

Subject: [Threads-devel] undefined reference to `boost::thread_resource_error::thread_resource_error()'
From: simon h (simonoch_at_[hidden])
Date: 2010-06-18 03:52:35


With boost_1_43_0 built and installed from source on a clean ubuntu machine
I get link errors when compiling my code:

.build/debug/magna/.singleunit.o: In function `recursive_mutex':
/usr/include/boost/thread/pthread/recursive_mutex.hpp:46: undefined
reference to `boost::thread_resource_error::thread_resource_error()'
...
.build/debug/magna/.singleunit.o:/usr/include/boost/thread/pthread/recursive_mutex.hpp:57:
more undefined references to
`boost::thread_resource_error::thread_resource_error()' follow
collect2: ld returned 1 exit status

Looking at the library,
 nm -C -D libboost_thread.so.1.43.0 | grep thread_resource_error
I can see the destructor but no constructors, similar to what's noted in
http://lists.boost.org/boost-users/2009/12/54835.php

The solution in that case was to roll back from 1.41 to 1.40 of boost.

In my case, the link errors were resolved by preceding my inclusion of
recursive_mutex by include boost thread exceptions:
#include <boost/thread/exceptions.hpp> // <--- add this line before
#include <boost/thread/recursive_mutex.hpp>

This seems sub-optimal to me. Shouldn't the recursive mutex header be self
contained??
Am I missing something? I think in previous versions of boost thread, 1.38
at least, I can see that constructors for recursive_thread_error in the
library & good for linking without extra include.

simon



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