Question

boost::recursive_mutex and boost::lock_guard seem to use boost_thread-bcb-mt-1_39.dll in C++ Builder 2010. I see that there is also static version - boost_thread-bcb-mt-1_39.lib.

My code is something like this:

boost::recursive_mutex mylock;
//...
boost::lock_guard<boost::recursive_mutex> lock(mylock);

However, if I set compile option to Release and set Dynamic RTL option to False all I get is Mixing a dll boost library with a static runtime is a really bad idea.... Returning Dynamic RTL to True compiles but then it needs additional DLL's - cc32100mt.dll and boost_thread-bcb-mt-1_39.dll.

Is there a way to compile it statically in a single exe? After all, LIB file is provided, it should be possible. Is it a problem with this version of C++ Builder or Boost?

Was it helpful?

Solution

What I needed was to define in a header file:

#define BOOST_THREAD_USE_LIB

right before:

#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/locks.hpp>

After then it compiles without any issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top