Link boost DLL (BOOST_ALL_DYN_LINK) ? Beginner..

Hi all, I did try use: BOOST_ALL_DYN_LINK, but I did't have success. The boost returns this to me: c:\Boost\include\boost-1_33_1\boost\config\auto_link.hpp(281): fatal error C1189: #error : "Mixing a dll boost library with a static runtime is a really bad idea..." How I fix this? My code: // BoostDefines.hpp : Defines the entry point for the console application. // //-------------------------------------------------------------------------- -- // //-------------------------------------------------------------------------- -- // Filename: BoostDefines.hpp // Type: Declaration // Language: Microsoft Visual C++ V7.1 // Module: //-------------------------------------------------------------------------- -- // Description: class BoostDefines //-------------------------------------------------------------------------- -- #ifndef BOOSTDEFINES_HPP #define BOOSTDEFINES_HPP #pragma once #define BOOST_ALL_DYN_LINK #define BOOST_THREAD_USE_DLL //thread header not compliant with 'BOOST_ALL_DYN_LINK' #define BOOST_LIB_DIAGNOSTIC #ifdef BOOST_ALL_DYN_LINK #pragma message("Include: dynamic linking with boost libraries") #endif #endif //BOOSTDEFINES_HPP // test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "BoostDefines.hpp" #include <boost/lexical_cast.hpp> #include <boost/regex.hpp> int _tmain(int argc, _TCHAR* argv[]) { //... //use boost //... return 0; }

c:\Boost\include\boost-1_33_1\boost\config\auto_link.hpp(281): fatal error C1189: #error : "Mixing a dll boost library with a static runtime is a really bad idea..."
If you want to use Boost as a dll, then you *must* also use your C/C++ runtime library as a dll, otherwise really bad things will happen to your code at runtime (this is a general Windows-compiler issue, not a Boost one). Adjust your project's runtime code generation settings to use a dll runtime and everything will be OK. John.
participants (2)
-
John Maddock
-
Renato Tegon Forti