Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 739
highsciguy Avatar asked Nov 23 '12 18:11

highsciguy


People also ask

How do I invoke a compiler?

You can invoke the command-line compiler by typing the name of its executable file into the command line, also known as the MS-DOS prompt. If you compile from the default Windows Command Prompt, you must type the fully qualified path to the executable file.

What is Intel ICX?

ICC (Linux), ICL (Windows) are classic Intel C/C++ Compilers. Whereas, ICX is Intel nextgen compiler based on Clang /LLVM technology plus Intel proprietary optimizations and code generation. You may use ICC for performance on CPU targets. ICX enables OpenMP TARGET offload to Intel GPU targets.


1 Answers

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

like image 154
Mahmoud Al-Qudsi Avatar answered Sep 20 '22 16:09

Mahmoud Al-Qudsi