我在VS2017项目属性(Windows 8.1上的VS2017版本15.9.6)中设置了一个称为PRIVATE_CODE的预处理程序定义:
但是,当我查看任何要定义的文件中的代码时,该代码未使用。我之所以知道是因为在深色主题的IDE中,IFDEF部分中的代码变暗了,而ELSE部分中的代码是正常亮度。
绝对可以肯定的是,我在每一节中都放了一段糟糕的代码,以查看哪一部分触发了编译器错误:
#ifdef PRIVATE_CODE
// This should trigger a compiler error.
adadfadsf;
#else
// Instead, I get a compiler error here, indicating that the compiler
// is not paying attention to the preprocessor definitions I set.
asdfadfff;
#endf
还有其他人有这个问题,并且知道为什么会这样吗?