Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately


VSCode + MSBuild 开发过程中出现如下警告:


Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately


处理方法为:


1. 在 c_cpp_properties.json 文件中加入 "_WIN32_WINNT=0x0A00" 的定义,配置如下:


{
  "configurations": [
    {
      "name": "Win32",
      "includePath": [        
        "${workspaceFolder}/**"
      ],
      "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE",
        "_WIN32_WINNT=0x0A00"
      ],
      "windowsSdkVersion": "10.0.22000.0",
      "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe",      
      "cStandard": "c17",
      "cppStandard": "c++17",
      "intelliSenseMode": "windows-msvc-x64",
      "configurationProvider": "ms-vscode.cmake-tools"
    }
  ],
  "version": 4
}


2. 在 CMakeLists.txt文件中加入

add_definitions( -D_WIN32_WINNT=0x0A00 )


----

posted @ 2024-03-22 17:57  ParamousGIS  阅读(146)  评论(0编辑  收藏  举报