vs2017中的MFC开发 [英] MFC development in vs2017

查看:123
本文介绍了vs2017中的MFC开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装vs2017时,确实选择了带有C ++选项的Windows开发.但是,安装后,我看不到已添加MFC.果然,在编译应用程序时出现错误,

严重错误C1083:无法打开包含文件:'afxwin.h':没有此类文件或目录

我在控制面板中的vs2017安装中找不到更改/修改"选项.如何添加用于C ++的Microsoft基础类"软件包?

解决方案

如果您在VS Installer窗口顶部附近查看,则会看到WorkloadsIndividual ComponentsLanguage Packs.

至少据我所知,工作负载"中没有一个将MFC包含在您的安装中.要获得它,您首先必须单击单个组件",然后向下滚动相当的方式以转到"SDK,库和框架"部分.在其中,您将找到用于ATL和MFC支持的组件的列表:

在VS 2019安装程序中,可能性列表甚至更长.对于141和142个构建集,都有适用于ARM,ARM64和x86/x64的版本,带有和不带有Spectre缓解措施:

但这并不一定就是故事的结局:默认情况下,即使您安装了它,它也只会安装MFC的Unicode版本.如果要使用窄字符版本,则必须单独安装.我认为安装程序中根本没有任何条目可以执行此操作-但是,如果您尝试构建使用窄字符MFC的项目,则会收到一条错误消息,其中包含下载它的链接.

When I installed vs2017, I did select Windows development with C++ option. After installation, however, I don't see the MFC has been added. Sure enough, I get errors when I compile my application,

fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory

I cannot find the Change/Modify option with my vs2017 installation in Control Panel. How can I add "Microsoft Foundation Classes for C++" package?

解决方案

If you look near the top of the VS Installer window, you'll see Workloads, Individual Components and Language Packs.

At least as far as I can see, none of the "Workloads" will include MFC in your installation. To get it, you first have to click on "Individual Components", then scroll quite a ways down to get to the "SDKs, libraries and frameworks" section. In there, you'll find a list of components for ATL and MFC support:

In the VS 2019 installer, the list of possibilities has gotten even longer. There are versions for ARM, ARM64, and x86/x64 both with and without Spectre mitigations, for each of the 141 and 142 build sets:

That's not necessarily the end of the story though: by default, even when you install that, it only installs the version Unicode build of MFC. If you want the narrow-character version, you have to install that separately. I don't think there's any entry in the installer to do this at all--but if you try to build a project that uses narrow-character MFC, you'll get an error message that includes a link to download it.

这篇关于vs2017中的MFC开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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