我的.h文件为正在使用的__cplusplus版本提供了以下代码:
#define CPP14_SUPPORTED (__cplusplus >= 201402L)
#if CPP14_SUPPORTED
#define IS_CPP14_SUPPORTED 1 // BUT THIS IS GREYED OUT in the .h file!
#endif主要问题是,我的所有.h文件都没有看到这个定义。
当我在我的IS_CPP14_SUPPORTED文件中使用定义.cpp时,它表明它是正确的,而不是灰色的。
我正在使用keil uvision5 IDE
发布于 2022-08-15 05:42:21
尝尝这个
#define CPP14_SUPPORTED __cplusplus >= 201402L
#if CPP14_SUPPORTED
#warning "cpp14 supported"
#else
#warning "Cpp14 not supported"
#endif用-std=c++14打印
<source>:3:5: warning: #warning "cpp14 supported" [-Wcpp]
3 | #warning "cpp14 supported"
| ^~~~~~~用-std=c++11打印
<source>:5:5: warning: #warning "Cpp14 not supported" [-Wcpp]
5 | #warning "Cpp14 not supported"
| ^~~~~~~https://stackoverflow.com/questions/73350690
复制相似问题