使用预编译头时重新定义_WIN32_WINNT

时间:2022-09-17 16:57:53

Hi I currently have a problem redefining _WIN32_WINNT even though I have

嗨,我现在有一个问题重新定义_WIN32_WINNT,即使我有

#define _WIN32_WINNT 0x0600
#define WINVER _WIN32_WINNT

in my stdafx.h it still defaults to 0x0603

在我的stdafx.h中它仍默认为0x0603

I'm currently using DDSTextureLoader that came with DirectX Tutorials and by beeing 603 it uses CreateFile2 and not CreateFile which creates an error :(

我目前正在使用DirectX Tutorials附带的DDSTextureLoader,并且通过使用CreateFile2而不是CreateFile来创建错误:

1 个解决方案

#1


Remove all the #defines in the header files, and add the preprocessor definitions -D_WIN32_WINNT=0x0600;-DWINVER=_WIN32_WINNT in the project configuration. This makes sure that the definitions take effect at the very beginning of the compiling process. For the details, see here.

删除头文件中的所有#defines,并在项目配置中添加预处理器定义-D_WIN32_WINNT = 0x0600; -DWINVER = _WIN32_WINNT。这可确保定义在编译过程的最初阶段生效。有关详细信息,请参见此处。

If it's not appropriate to remove the #defines in the headers. You may change them to the following:

如果删除标题中的#defines是不合适的。您可以将它们更改为以下内容:

#ifndef _WIN32_WINNT
#  define _WIN32_WINNT 0x0600
#endif
#ifndef WINVER
#  define WINVER _WIN32_WINN
#endif

#1


Remove all the #defines in the header files, and add the preprocessor definitions -D_WIN32_WINNT=0x0600;-DWINVER=_WIN32_WINNT in the project configuration. This makes sure that the definitions take effect at the very beginning of the compiling process. For the details, see here.

删除头文件中的所有#defines,并在项目配置中添加预处理器定义-D_WIN32_WINNT = 0x0600; -DWINVER = _WIN32_WINNT。这可确保定义在编译过程的最初阶段生效。有关详细信息,请参见此处。

If it's not appropriate to remove the #defines in the headers. You may change them to the following:

如果删除标题中的#defines是不合适的。您可以将它们更改为以下内容:

#ifndef _WIN32_WINNT
#  define _WIN32_WINNT 0x0600
#endif
#ifndef WINVER
#  define WINVER _WIN32_WINN
#endif