如何为win 7创建一个独立的exe文件 - 在Visual Studio 2017中从WinForms项目中获得10个 [英] How to create a standalone exe file for win 7 - win 10 out of an WinForms project in Visual Studio 2017

查看:80
本文介绍了如何为win 7创建一个独立的exe文件 - 在Visual Studio 2017中从WinForms项目中获得10个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个Windows窗体应用程序,我通过创建一个可以在别处运行的exe文件(在win7及更高版本的PC上)来解决问题。我定义:

This is my first Windows Forms application and I got troubles by creating an exe file that can run elsewhere (on PCs with win7 and higher). I defined:

#define _WIN32_WINNT_WIN7 0x0601
#define WINVER 0x0601


因此编译器应该知道这是Windows 7的exe。比我切换到发布模式一个内置的解决方案。尝试在win7机器上运行exe后,我得到了一个"api-ms-win-crt-heap-l1-1-0.dll缺失"。错误。所以问题是:
有人可以一步一步地描述如何编译这个项目吗?

 

So the compiler should know that this is an exe for windows 7. Than I switched to release mode an built the solution. After trying to run the exe on a win7 machine I've got an "api-ms-win-crt-heap-l1-1-0.dll is missing" error. So the question is: Can someone describe step by step how to compile this project?
 

推荐答案

您列出的预处理器宏通常用于本机C + Windows桌面应用程序。  Windows形成.net框架的应用程序目标版本。 此外,由于VS2017不包含用C ++创建Windows窗体
项目的模板,因此您的问题可能与Windows窗体无关。

The preprocessor macros that you have listed are typically used in native C+ Windows desktop applications.  Windows forms applications target versions of the .net framework.  Also, since VS2017 does not include templates to create windows forms projects in C++ it seems likely that your issue is unrelated to windows forms.

要定位Windows 7,您需要 -

To target Windows 7 you need to -

#define _WIN32_WINNT 0x0601

#define _WIN32_WINNT 0x0601

此外,请参阅
https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt


Also, see https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt

您是否在Windows 7系统上安装了VC ++可再发行组件?

Have you installed the VC++ redistributables on the Windows 7 system?


这篇关于如何为win 7创建一个独立的exe文件 - 在Visual Studio 2017中从WinForms项目中获得10个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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