【发布时间】:2011-07-22 20:17:57
【问题描述】:
我想做的是:
#if defined(CPLUSPLUS_OXFLAG)
//do something
#else
//do something else
#endif
现在我如何将传递给编译器 (g++) 的 -std=c++0x 参数捕获到 define 我的 CPLUSPLUS_OXFLAG 标志?
【问题讨论】:
-
你可以试试
#if __cplusplus >= 201103L #define CPLUSPLUS_OXFLAG #endif。 -
在标准 C++0x 中,"the macro __cplusplus will be set to a value that differs from (is greater than) the current 199711L"。我不确定实验性 C++0x GCC 实现是否会这样做。
标签: c++ compiler-construction c++11