【问题标题】:How to properly include windows.h and set minimum version to XP如何正确包含 windows.h 并将最低版本设置为 XP
【发布时间】:2013-03-14 02:52:03
【问题描述】:

我目前正在构建一个 C++ DLL,它位于主 DLL .cpp 文件的顶部。这目前导致警告"Warning C4005: '_WIN32_WINNT' : macro redefinition"。我做错了什么?

我需要包含windows.hSDKDDKVer.h 并将最低 Windows 版本设置为 XP。如何更正我的代码?

// System Includes
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <d3d9.h>

// Windows Version
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#include <SDKDDKVer.h>

【问题讨论】:

    标签: windows visual-c++ dll include windows-xp


    【解决方案1】:

    你应该首先包含 SDK 的东西:

    // Windows Version
    #define _WIN32_WINNT 0x0501     // _WIN32_WINNT_WINXP
    #include <SDKDDKVer.h>
    
    // System Includes
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <d3d9.h>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-26
      • 2010-12-15
      • 1970-01-01
      • 2017-12-09
      相关资源
      最近更新 更多