MFC 不支持 WINVER 小于 0x0501 [英] MFC does not support WINVER less than 0x0501

查看:23
本文介绍了MFC 不支持 WINVER 小于 0x0501的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 C++ 项目,它引用了许多其他项目/库.这是针对多年前创建的应用程序.大约每年更新一次,并完成一个新版本.多年来,我一直使用 Visual Studio 6 更新和构建这个应用程序的新版本,没有任何问题.

I have a C++ project that references many other projects/libraries. This is for an application that was created many years ago. About every once a year it is updated and a new version is done. I've used Visual Studio 6 to update and build new versions of this app for years now without any problems.

我正在尝试切换到 Visual Studio 10(现在是 VS2013).最初,由于 VS 版本之间的兼容性问题,我遇到了几个警告和错误.我能够照顾大部分.但是,我仍然对以下错误感到有些困惑:

I am trying to switch to Visual Studio 10 (and now VS2013). Initially I ran into several warnings and errors which were due to compatibility issues between the VS versions. I was able to take care of most. However, I'm still somewhat confused by the following error:

error C1189: #error : MFC 不支持小于 0x0501 的 WINVER.请在项目属性或预编译头文件中更改 WINVER 的定义.C:Program Files (x86)Microsoft Visual Studio 12.0VCatlmfcincludeafxv_w32.h

错误发生在一些引用的项目库中.我检查了有问题的项目库,但找不到对 WINVER 的任何引用.

The error occurs in a few of the referenced project libraries. I checked the project libraries in question and I cant find any reference to WINVER.

我在互联网上搜索了这方面的信息,并找到了一些主题,但没有特定于我的问题.有人能解释一下这里可能发生的事情吗?

I have searched the internet for info on this and found some topics but nothing that is specific to my problem. Can someone shed some light as to what might be happening here?

提前致谢.洛杉矶

推荐答案

如果您没有自己定义,所有 MFC 应用程序都会在某处定义 WINVER 宏值.我假设 MS 在其自己的头文件中默认删除了定义,现在强制您明确定义它.

All MFC apps define the WINVER macro value somewhere if you didn't define it yourself. I assume MS has removed the definition by default on its own header files and is now making mandatory that you explicitly define it.

因此,要解决您的问题,请将 #define 放在您的预处理器"编译器选项中,或者放在预编译头文件(即 stdafx.h)的顶部.

So, to solve your problem, either put the #define in your 'preprocessor' compiler options, or at the top of your precompiled header (ie stdafx.h).

注意 0x501 是 Windows XP 支持.0x600 是 Vista,0x601 是 Windows 7 — 想起那件事我有多难过!

Note 0x501 is Windows XP support. 0x600 is Vista, 0x601 is Windows 7 — and how sad am I for remembering that!

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

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