我可以使用什么预定义宏来检测?? [英] What predefined macro can I use to detect clang?
本文介绍了我可以使用什么预定义宏来检测??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图检测用于编译我的源代码的编译器。我可以轻松找到预定义的宏来检查MSVC或GCC(请参阅 http://predef.sourceforge.net/
有人知道clang是否定义了一个宏,如 使用 __ CLANG __ $
+ 找到答案。
grep
:
$ strings / usr / bin / clang | grep __ | grep -i clang
__clang__
I'm trying to detect the compiler used to compile my source code. I can easily find predefined macros to check for MSVC or GCC (see http://predef.sourceforge.net/ for example), but I cannot find any macro to check for clang.
Does someone know if clang defines a macro like __CLANG__
in order to know what is currently compiling my code ?
解决方案
Found the answer using strings
+ grep
:
$ strings /usr/bin/clang | grep __ | grep -i clang
__clang__
这篇关于我可以使用什么预定义宏来检测??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文