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

前端 未结 11 1823
一生所求
一生所求 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:45

    Haven't found a solution to this published anywhere online, so here's what worked for me.

    I'm building a project with 110_xp tools

    I get these warnings ...

    c:\program files (x86)\microsoft sdks\windows\v7.1a\include\sal_supp.h(57): warning C4005: '__useHeader' : macro redefinition
              C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\sal.h(2872) : see previous definition of '__useHeader'
    c:\program files (x86)\microsoft sdks\windows\v7.1a\include\specstrings_supp.h(77): warning C4005: '__on_failure' : macro redefinition
              C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\sal.h(2882) : see previous definition of '__on_failure'
    

    Clearly an inconsistency between the VC 11 headers and 7.1a sdk headers.

    In my stdafx.cpp I did this ...

    #define _USING_V110_SDK71_
    
    #include "stdafx.h"
    

    ... the build problem has gone away.

提交回复
热议问题