为什么 "small" 给出关于 "char" 的错误?

Why does "small" give an error about "char"?

尝试在 windows 平台 运行 QT5.4 上使用 x86 中的 VS2010、VS2012 和 x86_64 编译开源项目。

名为 unit.h 的文件包含一个部分:

[...]
// DO NOT change noscale's value. Lots of assumptions are made based on this
// value, both in the code and (more importantly) in the database.
enum unitScale
{
   noScale = -1,
   extrasmall = 0,
   small = 1, // Line that causes errors.
   medium = 2,
   large = 3,
   extralarge = 4,
   huge = 5,
   without = 1000
};
[...]

生成

我想尽了一切办法来解决它。我删除了代码中对 "small" 枚举的所有使用,但仍然出现错误。但是在删除所有用途后,我将 "small" 重命名为 "smallo" 一切都很好。这似乎表明名称冲突,但文件搜索没有给我整个项目的参考。这不是我所知道的任何关键字。

有什么想法吗?

编辑:感谢非常有帮助的评论,这里有一个更奇怪的版本有效。有人可以解释一下吗?

#ifdef small // Same with just straight "#if"
#pragma message("yes")
#endif
#ifndef small
#pragma message("no") // Always prints no.
#endif

#undef small
enum unitScale
{
   noScale = -1,
   extrasmall = 0,
   small = 1,
   medium = 2,
   large = 3,
   extralarge = 4,
   huge = 5,
   without = 1000
};

编辑 2:pragma 指令显示是,但仅在先前加载了 windows.h header 的文件中显示,并且它在编译器输出中丢失了。 谢谢大家!多么艰巨的任务。

small 是在 rpcndr.h 中定义的。它用作 MIDL.

的数据类型