错误 C2371"DWORD":重新定义;不同的基本类型

Error C2371 'DWORD': redefinition; different basic types

本文关键字:类型 DWORD C2371 新定义 错误 定义      更新时间:2023-10-16

我得到这个错误" error C2371 'DWORD': redefinition;不同的基本类型",同时在Visual Studio 2015上使用MFC编译Visual c++代码。当我双击错误时,它带我到stint .h第23行:

typedef unsigned int       uint32_t;

如果我在我的代码中发现了DWORD并按下f12它会带我到minwindefine。h第156行:

typedef unsigned long       DWORD;

我没有显式地包含这些文件中的任何一个,所以我不知道这些文件是按什么顺序包含的。我完全迷失在这里做什么来修复这个错误。有人知道吗?

我发现了错误,它是在一个3rdpartyapi.h:

#ifndef uint32_t
# define uint32_t DWORD
#endif

我所做的只是把#include <cstdint>放在#ifndef之前,错误就消失了。谢谢大家的帮助。