How to find the cause of a debug runtime dependency in a release build
My C ++ project in VS2015 outputs a DLL file. This project depends on vagarious * .lib files. When I check the output DLL with the dependent walker, it shows that it depends on VCRUNTIME140D.DLL. But I was building the project in release mode.
So, anyway, to find what it means to tie myself to debug timing, even if I'm building a project with release mode.
In fact, you should be able to see exactly what is causing the dependency through the Dependency Walker. I created a sample solution with two projects that output DLLs. The first of the projects references the second, and the second uses a debug workbench even in release mode, so building the first dll project in release mode will output a DLL that references both release and debug time versions. This is what I get when looking at the first dll using Dependency Walker:
So, as you can see, by carefully examining the list of imported libraries, you can find out which one is importing the debug version of the runtime.
EDIT
Ok, if the dependency comes from a file .lib
, then the best I can think of is:
1) Include verbose linker output like this:
2) Build and view the output window to see which file is .lib
triggering the download of the junk .dll
, in my case it shows what MixedModeDll2.lib
triggers the download MSVCRTD
: