VS2012 C++ warning C4005: '__useHeader': macro redefinition

前端 未结 11 1871
一生所求
一生所求 2020-12-15 16:55

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:<

11条回答
  •  佛祖请我去吃肉
    2020-12-15 17:37

    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)
    

    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.

    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.

提交回复
热议问题