无法执行代码,因为找不到msvcp140.dll / vcruntime.dll [英] Code cannot be executed because msvcp140.dll/vcruntime.dll not found

查看:209
本文介绍了无法执行代码,因为找不到msvcp140.dll / vcruntime.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个项目并生成了一个exe文件。在我安装了visual studio的机器上正常运行。当我在另一台没有安装visual studio的机器上运行该exe时,它给了我上面的错误。 />


**为此,我需要安装Visual Studio 2017可再发行组件,然后exe运行正常。有没有安装Visual Studio 2017可再发行软件包的方法我可以添加那些以上所需的dll在我的项目中,并且可以在没有上述软件包的任何机器上运行。



我尝试过:



我尝试更改属性 - > General->使用MFC:从标准Windows库到在静态库中使用mfc在visual studio 2017中。但这增加了我的非常可执行的大小。还有其他方法吗?

i build a project and generated an exe file.it is running fine in my machine where visual studio is installed.when i am running that exe in another machine where visual studio not installed it is giving me the above error.

**For that i need to install visual studio 2017 redistributable packages and then the exe is running fine.Is there any way without installing visual studio 2017 redistributable packages can i add those above required dll's in my project and can run on any machine without the above packages.

What I have tried:

I tried changing properties->General->Use of MFC :from "standard windows libraries" to "use mfc in static library" in visual studio 2017.But that is increasing my executable size very much.Is there any other way?

推荐答案

不建议将单个文件复制到其他机器上......

你应该创建一个包含所有的安装程序其中的依赖...

如果你确定你没有超出C ++核心的依赖,你可以使用 Visual C ++ Redistributable 包来获得你的版本...这将无效......
Copying a single file to and other machine is not advised...
You should create an installer with all the dependencies in it...
If you are sure that you have no dependencies beyond the C++ core you can use the Visual C++ Redistributable package for your version... less than that will not work...


这是一个 Inno Setup 安装程序,支持大量软件包: GitHub - stfx / innodependencyinstaller:模块化InnoSetup依赖安装程序 [ ^ ]

好​​的一点是,大多数是网络安装程序,比如你需要的VC可再发行组件,所以这不会使你的安装程序包变大。
Here is an Inno Setup installer that supports a plethora of packages: GitHub - stfx/innodependencyinstaller: Modular InnoSetup Dependency Installer[^]
The nice thing is that most are web installers, like the VC redistributables you need, so this won't make your setup package larger.


您必须安装运行时,作为单独的安装或作为先决条件的应用程序的安装程序的一部分。你无法安装运行时。
You MUST install the runtime, either as a separate installation or as part of the Setup for your application as a prerequisite. You cannot get around installing the runtime.


这篇关于无法执行代码,因为找不到msvcp140.dll / vcruntime.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆