Boost threads libraries? linking problem and question
I have a large (at least non-trivial) C++ application that uses Boost threads. I am now trying to get it building as a Managed C++ (aka C++ .NET) application. The original unmanaged MFC application used the following import library: ..\boost\boost_1_32_0\bin\boost\libs\thread\build\boost_thread.dll\vc-7_1\release\threading-multi\boost_thread-vc71-mt-gd-1_32.lib The managed C++ Forms application requires that AND a second library which seems to be a static library and not an import library for a DLL: ..\boost\boost_1_32_0\bin\boost\libs\thread\build\libboost_thread.lib\vc-7_1\debug\runtime-link-static\threading-multi\libboost_thread-vc71-mt-sgd-1_32.lib It seems wrong that I need two Boost thread libraries to build with. Hoewver, my project won't build without both. There are apparently some #pragma-like instructions in the Boost source that trigger the linking of these libraries. If I do link with both Boost thread libraries, the project builds but gets bizarre exceptions at runtime that are buried in non-debuggable code. What is the difference between those Boost libraries? Which one is the one that I want? How can I stop the linker directives in the code from including the library that I shouldn't be using?
I have a large (at least non-trivial) C++ application that uses Boost threads. I am now trying to get it building as a Managed C++ (aka C++ .NET) application.
The original unmanaged MFC application used the following import library: ..\boost\boost_1_32_0\bin\boost\libs\thread\build\boost_thread.dll\vc-7_1\release\threading-multi\boost_thread-vc71-mt-gd-1_32.lib
The managed C++ Forms application requires that AND a second library which seems to be a static library and not an import library for a DLL: ..\boost\boost_1_32_0\bin\boost\libs\thread\build\libboost_thread.lib\vc-7_1\debug\runtime-link-static\threading-multi\libboost_thread-vc71-mt-sgd-1_32.lib
Not only that, but it's built against a different C++ runtime, so it's no surprise that you get runtime errors (I'm surprised it linked actually).
It seems wrong that I need two Boost thread libraries to build with.
Correct. What errors were you getting from the one library alone?
Hoewver, my project won't build without both. There are apparently some #pragma-like instructions in the Boost source that trigger the linking of these libraries.
If I do link with both Boost thread libraries, the project builds but gets bizarre exceptions at runtime that are buried in non-debuggable code.
What is the difference between those Boost libraries?
Which one is the one that I want?
How can I stop the linker directives in the code from including the library that I shouldn't be using?
Define BOOST_THREAD_NO_LIB to suppress auto-linking of the thread code, but before you do that try defining BOOST_THREAD_USE_LIB which will force your app to do a static link to the thread lib. I'm guessing, but I suspect that the dll has an export missing somewhere. John.
participants (2)
-
John Maddock
-
Roger Wilco