Reputation: 2928
Let's say I built the following C++ code into HelloWorld.exe
with Visual Studio 2015, targeting Release, platform x64.
#include <iostream>
int main()
{
std::cout << "Hello world!!" << std::endl;
return 0;
}
Years ago, I could simply copy msvcp###.dll
(or msvcr###.dll
for C) along with HellowWorld.exe
and have a runnable program.
I have just installed VS2015, and now it seems that I can't just bring msvcp140.dll
along. There seems to be 70~ish api-ms-win-.....dll
files in my System32
folder that need to come with it.
I know the best policy is to have them install the redistributable... but for cases where they can't, copying the .DLL used to be a viable alternative. Is it still the case? Am I missing something easy?
To sum up: I had thought I could just copy msvcp140.dll
and have it work, but this doesn't seem to be the case. Am I wrong?
Note: I don't see the api-ms-....dll
files in the list of things you are allowed to redistribute. Or is it understood this is part of the 2015 runtime and that comes along with it?
Upvotes: 2
Views: 282
Reputation: 300
You can distribute the VC 2015 redistributable with your installer.
https://www.microsoft.com/en-us/download/details.aspx?id=48145
If that's not an option, statically link it.
You can also run depends to determine what other DLL's you need. You can ignore api-ms*.dll's: Dependency Walker: missing dlls
Upvotes: 0
Reputation: 1868
Rather than dealing with installing redistributables, I tend to statically link the runtime (/MT and /MTd compiler options).
It does result in a larger file size, but it's smaller than shipping the DLLs by far.
Upvotes: 1