适用于任何PC的Visual Studio 2017 C ++ Exe(链接vcruntime140.dll) [英] Visual Studio 2017 C++ Exe for any pc (linking vcruntime140.dll)

查看:446
本文介绍了适用于任何PC的Visual Studio 2017 C ++ Exe(链接vcruntime140.dll)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用c ++进行GUI编程非常陌生,因此我没有那么多经验.

I'm very new to GUI programming in c++, thus I don't have that much experience.

我使用Visual Studio 2017 CRL程序包为自己的程序创建了一个GUI,现在我正在尝试使此exe文件适用于所有人. 对于那些安装了Visual Studio或VC Runtime的用户,该应用程序运行良好,但对于那些没有安装该程序的用户,该应用程序会抛出类似"Windows运行该应用程序的计算机缺少vcruntime140.dll"的信息. 我不确定如何在程序中链接这些dll,以便每个人都可以使用它. 我也不知道如何链接dll.

I created myself a GUI for my programm using the Visual Studio 2017 CRL package and now I'm trying to make this exe available for everyone. The application works fine for those who have Visual Studio or VC Runtime installed but for those who don't the programm throws something like: "vcruntime140.dll is missing on your computer to run this app". I am not sure how to link these dll's in my programm so that EVERYONE is able to use it. I'm also not quit sure how I would link dll's.

推荐答案

基本上有两个选择.

业界的标准是将Visual Studio 20xx Runtime Redistributable安装程序与您的程序一起提供,并在任何人试图自己运行程序之前先运行它,以确保将.dll文件安装到目标计算机上.

The Standard in the industry is to ship the Visual Studio 20xx Runtime Redistributable Installer alongside your program, and have it run before anyone tries to run your program themselves, to make sure that the .dll files are installed onto the target computer.

另一个选择是在编译时更改将库链接到可执行文件的方式.这是通过Visual Studio中的标志完成的:

The other option is to change the way that the libraries are linked to the executable at compile-time. This is done with a flag in Visual Studio:

基本上,您想根据自己的意愿将运行时库字段更改为 Multi-Threaded Multi-Threaded Debug 相对于默认的多线程DLL",它处于释放"或调试"模式.

Basically, you want to change the Runtime Library field to either say Multi-Threaded or Multi-Threaded Debug depending on whether you're in Release or Debug mode, as opposed to "Multi-Threaded DLL", which is the default.

但是,请注意,您需要确保使用的每个库都以相同的方式编译:如果其中任何一个是使用运行时库的DLL版本编译的,则它们将与您的代码互操作有趣的方式,而您遇到的问题最少的是,他们无论如何都需要安装DLL,这使您付出了很多努力.

Note, however, that you need to make sure that every single library you're using was compiled the same way: if any of them were compiled using the DLL version of the Runtime Library, they'll interoperate with your code in funny ways, and the least of your problems will be that they'll need the DLLs installed anyways, defeating your effort.

自然地,如果您所有的库都是Header-Only,这不是问题,但是如果其中任何一个都已编译,那么您将需要使用正确的设置重新编译它们.

Naturally, that's not an issue if all your libraries are Header-Only, but if any of them have been compiled, then you'll need to recompile them using the correct settings.

这篇关于适用于任何PC的Visual Studio 2017 C ++ Exe(链接vcruntime140.dll)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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