How to statically link to MSVCP120.dll in VS2013

2019-08-08 16:08发布

问题:

When I launch .exe it gives error MSVCP120.dll is missing. How do I add statically link to project. Is it in Linker? Do I need to give path to MSVCP120.dll?

回答1:

In general, you should not use static CRT linking as it creates a number of potential problems, security risks, and servicing concerns. You can require the VC++ REDIST package to be run (which requires admin rights) to install the 'system' version, you can use the VC++ MSM modules with your own MSI installer, or you can just use side-by-side deployment and put the DLLs in the same folder as your EXE.

See Redistributing Visual C++ Files

You can use static linking for Win32 desktop apps, but there's only a few places where such use is warranted (namely pre-installation utilities). The CRT settings are the same as other Visual Studio editions as part of the compilation as a command-line switch or a setting in the IDE under Project Properties / C/C++ / Code Generation to either "Multi-threaded (/MT)" or "Multi-threaded debug (/MTd)"

You cannot use static linking for Windows Store apps, Windows phone 8.x, or Xbox One apps.