MSVCP140D.dll missing, is there a way around?
You should distribute release version of executable that will depend upon VS 2017 redistributable package rather than debug version that depend on debug runtime libraries (notice the D
suffix in library name).
System error: The program can't start because MSVCP140D.DLL is missing from your computer. Try reinstalling the program to fix this problem
You are using the debug visual studio runtime, if you want to try it on another computer you should recompile your code in release mode and make sure that the appropriate visual studio runtime redistributable is installed.
If you really need to run a debug executable on another machine you need to make sure you copy the correct runtime (32 or 64-bit according to how you've compiled your program), this can be found in C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\14.24.28127\debug_nonredist
(at least for visual studio 2019, the exact path will be slightly different depending on your visual studio version, e.g. visual studio 2015 uses C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\debug_nonredist
).
Can´t find proper MSVCP140d.dll dependency while loading my own DLL, even though its present in the folder
You should not be shipping code based on the debugging versions of the runtime library DLLs. Microsoft do not support this. DLL names are not case-sensitive, BTW, so that's a red herring.
MSVCP140.dll missing
Either make your friends download the runtime DLL (@Kay's answer), or compile the app with static linking.
In visual studio, go to Project tab -> properties - > configuration properties -> C/C++ -> Code Generation
on runtime library choose /MTd
for debug mode and /MT
for release mode.
This will cause the compiler to embed the runtime into the app. The executable will be significantly bigger, but it will run without any need of runtime dlls.
Visual Studio setting to deal with missing MSVCP140D.dll
What I am doing now is just doing release builds with symbols.
https://msdn.microsoft.com/en-us/library/fsk896zz.aspx?f=255&MSPPError=-2147217396
This is especially useful now, since I am writing plugins for other software that does not like to load debug versions of the DLLs I create. Sometimes you can't see the local stack varibles for a function, but you can always see member and instance variables, as well parameters, so this works best for me, and then one does not have to worry about SDK binding issues like above.
C++ debugging: MSVCP140D.dll is either not designed to run on Windows
Hans Passant suggested that the error code means the dll file in C:\Windows\System32\
is broken.
I checked that indeed the dll in System32
(981,552 bytes, unsigned, only some entries on the file properties details tab filled) is different from the one distributed with VS (981,744 bytes, signed, full information on the file properties details tab). Hence I decided to replace the current "msvcp140d.dll" in System32
by renaming it into "msvcp140d_orig.dll" and copying the one from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Redist\MSVC\14.16.27012\debug_nonredist\x64\Microsoft.VC141.DebugCRT\
over.
Now debugging works.
I am not 100% convinced VS should use that file opposed to the one distributed with the workload in the first place, but at least my problem is solved and I can debug the code.
Related Topics
Does Std::Cout Have a Return Value
Find Two Elements in an Array That Sum to K
How to Enforce the 'Override' Keyword
Std::Remove_If - Lambda, Not Removing Anything from the Collection
Ways to Detect Whether a C++ Virtual Function Has Been Redefined in a Derived Class
What Is the Purpose of a Declaration Like Int (X); or Int (X) = 10;
When Is C++ Covariance the Best Solution
Is There a Standard Date/Time Class in C++
Two Classes That Refer to Each Other
How to Run the Preprocessor on Local Headers Only
Algorithm to Add or Subtract Days from a Date
Can a Variable Be Declared Both Static and Extern
How to Compare Two Character Strings Statically at Compile Time
Both Asterisk and Ampersand in a Parameter