Running .exe without copying .dlls

2020-03-04 08:47发布

问题:

I have Visual Studio 2015 solution ready for delivery. I have a requirement that the .exe should run out of the box. However, I am getting "missing dll..." errors. Is there any way I could make it possible for someone to run the exe without him needing to download bunch of ddls? Can I build the .exe to be executable as stand-alone somehow?

回答1:

Yes, you have to statically link the binary. In the project settings (Configuration Properties -> C/C++ -> Code Generation), use /MT, /MTd for the Release, Debug configurations respectively. However, this bloats the size of the executable.

MSDN documentation on /MT, /MTd options