Search code examples
c++cgcciccpredefined-macro

Detect ICC vs GCC at compile time


How to detect at compile time if I'm using gcc or icc?

(I was quite puzzled to find out that icc defines __GNUC__ -- and even __GNUC_MINOR__ and __GNUC_PATCHLEVEL__ ! why?)


Solution

  • We use

    #ifdef __INTEL_COMPILER
    

    to split icc off, assuming gcc as a default.