0

我想根据编译器类型有条件地编译代码的某些部分是否有任何宏?

像这样:

#if defined (COMPILER_TYPE e.g. GCC)
// Compile this
#elif defined (COMPILER_TYPE e.g. Visual Studio C Compiler)
// Else this
#endif

谢谢

4

1 回答 1

2

__GNUC__您可以检查是否为 GCC 和_MSC_VERMSVC定义了这些宏。

于 2012-04-06T05:12:37.880 回答