在其它电脑(比如Windows Server 2012)上运行Visual Studio编译出来的应用程序,结果报错:“无法启动此程序,因为计算机中丢失VCRUNTIME140.dll。尝试重新安装该程序以解决此问题。”
![](https://img-blog.csdnimg.cn/3159870d8f7449209393f1f56f4f538c.png)
解决方法:
属性 -> 配置属性 -> C/C++ -> 代码生成 -> 运行库 -> 多线程(/MT)
![](https://img-blog.csdnimg.cn/f16dab35ab8b4100aa211f28d5128619.png)
在要部署的电脑上安装《Microsoft Visual C++ Redistributable latest supported downloads》
如果是Visual Studio 2015, 2017, 2019, and 2022,可以安装这个:
![](https://img-blog.csdnimg.cn/64cc0643b417458d8515bf9522cc1f8f.png)
编译出来的是X86程序安装 https://aka.ms/vs/17/release/vc_redist.x86.exe
编译出来的是X64程序安装 https://aka.ms/vs/17/release/vc_redist.x64.exe
安装完后就可以正常启动exe了。