3
votes

I'm compiling my app /MT and linking against the boost -mt-s libraries (multithreaded static), but the boost regex library (version 1.45) seems to be pulling in the /MD msvcrt.lib, which causes linker errors.

I can workaround the problem using /NODEFAULTLIB:msvcrt.lib, but I'd much rather fix it. It it a known bug in boost or am doing something stupid?

Relevant linker (/VERBOSE:lib) output:

Searching /boost/stage/lib\libboost_regex-vc100-mt-s-1_45.lib: Searching C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB\msvcprt.lib:

Finished searching libraries LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

2

2 Answers

1
votes

I am generally a C#/Dot Net developer, but now have a native windows C++ project which has to link to static Boost libraries. While I would prefer to use dll's/assemblies throughout the application (safety related) dictates otherwise.

I too am using Visual Studio 2010 and initially struggled to link to the static boost libraries. I found the only way to do this was to create a new Win 32 static library to interoperate with the Boost library.

-1
votes

The short answer is not to use multithreaded static configs, ever. Newer versions of Visual Studio don't even allows this as an option.