c++ - 如何摆脱 _WIN32_WINNT 未定义警告?

标签 c++ visual-c++

_WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)

这个错误在我的编译过程中不断弹出。它似乎不影响编译,但我应该如何摆脱它?我是否会因为忽略它而冒任何风险?

最佳答案

将其设置为您希望程序在其上运行的最旧的 Windows 操作系统。 此 MSDN 文章 Using the Windows Headers 中给出了可能的值。 .

You can define these symbols by using the #define statement in each source file, or by specifying the /D compiler option supported by Visual C++.

For example, to set WINVER in your source file, use the following statement:

 #define WINVER 0x0502    // Windows Server 2003 with SP1, Windows XP with SP2

To set _WIN32_WINNT in your source file, use the following statement:

#define _WIN32_WINNT 0x0502    // Windows Server 2003 with SP1, Windows XP with SP2

To set _WIN32_WINNT using the /D compiler option, use the following command:

cl -c /D_WIN32_WINNT=0x0502 source.cpp

关于c++ - 如何摆脱 _WIN32_WINNT 未定义警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12871513/

相关文章:

c++ - 在 C++ 中删除 char 数组末尾的输入键值

c++ - 如何找到 n 个最大元素的索引

c++ - g++ L"string~"+ 运算符,类似于 Visual C++

C++ : Simultaneously calling more than one *. 可执行文件

C++ 和 SDL : Why can't I compile this program?

c - 表达式 : addition of two value of type unsigned char 的确切类型是什么

c++ - 通过 tcp 将数据流存储到大型数组中的最佳方法是什么?

c++ - 我应该学习 GTK+ 还是 GTKMM?

c++ - 如何在 C++ 中使用类原型(prototype)

c++ - 为什么(成员)函数指针在 Visual C++ 中表现得如此怪异?