Search code examples
cmacrosc-preprocessorintelicc

How to detect Intel's compiler (ICC) with ifdef?


I want to use Intel's current compiler on Linux. I have an inline macro which is supposed to detect the compiler.

It used to work with past versions of GCC and ICC. But now I get extern inline with ICC. Does ICC now define __GNUC__? How would you detect ICC or Intel's C++ compiler, ICPC?

#ifndef INLINE
# if defined(__GNUC__) || defined(__GNUG__)
#  define INLINE extern inline
# else
#  define INLINE inline
# endif
#endif

Solution

  • __INTEL_COMPILER is what you are looking for. (Source: ICC man page)