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

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

    For me this happened with Visual Studio 2017 (both fresh and repaired installation). Obviously the Windows 7.1 SDK had been installed before VS2017 and had been integrated into a Visual Studio 2005 installation.

    In my case the two files:

    • %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props
    • %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.x64.user.props

    contained references to the include directories and libraries of the Windows 7.1 SDK. Removing these references did the job.

    Keep in mind that every single C++ project for Win32 and x64 respectively inherits from these property sheets.

提交回复
热议问题