0
votes

I'm building a C++ DLL with Visual Studio 2015, and I'd like to deploy a debug build to another (internal, not customer) machine without a Visual Studio dev environment, which means I'll have to statically link to MSVCRT (linker option '/MTd'). My project depends on a static library foo.lib (debug version) that seems to be built with '/MDd', and while linking, it expectedly throws:

"foo.lib(bar.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in dllmain.obj"

Is there any way I can override this and force '/MTd'?

1
Do you have the source for foo.lib? If so, just build it with /MTd. If not, I think you are hosed. - Martin Bonner supports Monica

1 Answers

0
votes

If you have your external lib sources, then you could simply rebuild it using /MTd compiler switch. If no source is available, then there is no way to force a different runtime usage model. If you are trying to distribute nonrelease version for the need of remote debugging some issue on the client machine, you could deploy a Release version, but with disabled optimization, enabled runtime checks, debug information, etc. As long as you are not stepping into standard library elements, debugging should work just fine.