错误C1189#错误:C ++标准库禁止宏化关键字“内联”

问题描述

我正在将一个项目从VS 2010迁移到VS2019。我的代码在VS 2010中工作正常,而在VS2019中由于相同的代码出现错误

#undef inline
#define inline __forceinline

..///
..///code 

#undef inline
#define inline inline

Error C1189 #error: The C++ Standard Library forbids macroizing the keyword "inline". Enable warning C4005 to find the forbidden define

如何清除此错误

解决方法

我通过将 _XKEYCHECK_H 添加到Properties > C/C++ > Preprocessor > Preprocessor Definitions来解决此问题。
参考here

enter image description here