VS2012 C ++警告C4005:'__useHeader':宏重新定义 [英] VS2012 C++ warning C4005: '__useHeader': macro redefinition

查看:2812
本文介绍了VS2012 C ++警告C4005:'__useHeader':宏重新定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将一个旧的C ++项目从Visual Studio 6迁移到Visual Studio 2012时,我们在标准Microsoft平台标题中发现了一组奇怪的警告:

While migrating an old C++ project from Visual Studio 6 up to Visual Studio 2012, we came across an odd set of warnings from inside the standard Microsoft platform headers:


  • 警告C4005:'__useHeader':宏重新定义

  • 警告C4005:'__on_failure':宏重新定义

在线搜索只找到几个其他人遇到此错误。在某些情况下,人们试图使用VS2012编译旧的DirectX代码 - 我不在做。在其他情况下,人们试图使用VS2012目标Windows XP(使用更新1的新选项) - 我正在做。

An online search only found a few other people running into this error. In some cases, it was people trying to use VS2012 to compile legacy DirectX code - which I am not doing. In other cases, it was people trying to use VS2012 to target Windows XP (using the new option from Update 1) - which I am doing.

DirectX问题被回答警告将永远在那里告诉你,你正在编译的DirectX的过时(Win8版本)版本,你只需要与它一起生活。

The DirectX question was answered that the warning will always be there to tell you that you're compiling with an out-of-date (pre-Win8) version of DirectX, and you'll just have to live with it.

Windows XP问题没有得到解答。其他人只是说他们不能重现这个问题。

The Windows XP question was not answered. Other people simply said that they couldn't reproduce the problem.

我复制了它,并找到原因,我在这里写信来帮助任何人遇到这个

I reproduced it, and found the cause, which I am writing up here to help anybody else who encounters this.

推荐答案

进入项目属性,找到预处理器定义字段。

Go into the project properties, and find the "Preprocessor Definitions" field.

除了默认和添加的定义常量,你应该看到一个宏:

In addition to the default and added definition constants, you should see a macro:

%(PreprocessorDefinitions)

这个宏显然带来了一些额外的编译器提供的预处理器定义。我不知道什么版本的Visual Studio引入了这个宏,但它在Visual Studio 6中不存在。

This macro apparently brings in some additional compiler-provided preprocessor definitions. I am not sure what version of Visual Studio introduced this macro, but it was not there in Visual Studio 6.

在Visual Studio 2012中,此宏必须出现在项目的预处理器定义字段中。它也可能需要在早期版本的Visual Studio,但我没有测试这些。

In Visual Studio 2012, this macro is required to be present in your project's Preprocessor Definitions field. It may also be required in earlier versions of Visual Studio, but I have not tested these.

如果这个宏缺失,你会看到如上所示的错误消息。

If this macro is missing, you will see the error messages as shown above.

这篇关于VS2012 C ++警告C4005:'__useHeader':宏重新定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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