# Use Predefined Macros for Intel® Compilers

This topic describes macros that affect the various Intel® Compilers.

When you install both the Intel® oneAPI Base Toolkit (Base Kit) and the Intel® oneAPI HPC Toolkit (HPC Kit), you will notice that there are three compilers installed:

- Intel® DPC++ Compiler
- Intel® C++ Compiler
- Intel® C++ Compiler Classic

### Note

The Intel® DPC++ Compiler and Intel® C++ Compiler documentation is combined into a single Developer Guide and Reference, which can be found on the Intel Developer Zone.

## Different Compilers and Drivers

The table below provides the different compiler front-end and driver information.

### Note

To use Microsoft C++ (MSVC) compatible options, use `dpcpp-cl`.

Compiler | Notes | Linux* Driver | Windows* Driver
--- | --- | --- | ---
Intel® DPC++ Compiler | A C++ and Khronos SYCL* compiler with a Clang front-end | `dpcpp` | `dpcpp` (`clang` compatible) `dpcpp-cl` (`clang-cl` compatible)
Intel® C++ Compiler | A C++ compiler with a Clang front-end, supporting OpenMP* offload | `icx` for C `icpx` for C++ | `icx`
Intel® C++ Compiler Classic | A C++ compiler with EDG front-end, supporting OpenMP* but not OpenMP offload | `icc` for C `icpc` for C++ | `icl`

## Predefined Macros for Each Compiler

You can use the following predefined macros to invoke a specific compiler or version of a compiler.

Compiler | Predefined Macros to Differentiate from Other Compiler | Notes
--- | --- | ---
Intel® DPC++ Compiler | `SYCL_LANGUAGE_VERSION` `__INTEL_LLVM_COMPILER` `__VERSION` | `SYCL_LANGUAGE_VERSION` is defined in SYCL spec and should be defined by all SYCL compilers. `__INTEL_LLVM_COMPILER` is used to select the compiler.
Intel® C++ Compiler | `__INTEL_LLVM_COMPILER` `__VERSION` | `__INTEL_LLVM_COMPILER` is used to select the compiler. `__VERSION` is used to select the compiler version.
Intel® C++ Compiler Classic | `__INTEL_COMPILER` `__INTEL_COMPILER_BUILD_DATE` | `__INTEL_COMPILER` is used to select the compiler. `__INTEL_COMPILER_BUILD_DATE` is used to select the compiler build.

## Predefined Macros for Intel® DPC++ Compiler

See the example below using `#if defined(SYCL_LANGUAGE_VERSION) && defined (__INTEL_LLVM_COMPILER)` to define a code block specific to the Intel® DPC++ Compiler:

    // dpcpp only
    #if defined(SYCL_LANGUAGE_VERSION) && defined (__INTEL_LLVM_COMPILER)
       // code specific for DPC++ compiler below
       // ... ...

       // example only
       std::cout << "SYCL_LANGUAGE_VERSION: " << SYCL_LANGUAGE_VERSION << std::endl;
       std::cout << "__INTEL_LLVM_COMPILER: " << __INTEL_LLVM_COMPILER << std::endl;
       std::cout << "__VERSION__: " << __VERSION__ << std::endl;
    #endif

Example output using the Intel® oneAPI Toolkit Gold release with an Intel DPC++ Compiler patch release of 2021.1.2:

Windows | Linux
--- | ---
    SYCL_LANGUAGE_VERSION: 202001

    __INTEL_LLVM_COMPILER: 202110

    __VERSION__: Intel® Clang Based C++, clang 12.0.0
    SYCL_LANGUAGE_VERSION: 202001

    __INTEL_LLVM_COMPILER: 202110

    __VERSION__: Intel® Clang Based C++, gcc 4.2.1 mode

## Predefined Macros for Intel® C++ Compiler

See the example below using `#if !defined(SYCL_LANGUAGE_VERSION) && defined (__INTEL_LLVM_COMPILER)` to define a code block specific to the Intel® C++ Compiler:

    // icx only
    #if !defined(SYCL_LANGUAGE_VERSION) && defined (__INTEL_LLVM_COMPILER)
       // code specific for Intel C++ Compiler below
       // ... ...

       // example only
       std::cout << "__INTEL_LLVM_COMPILER: " << __INTEL_LLVM_COMPILER << std::endl;
       std::cout << "__VERSION__: " << __VERSION__ << std::endl;
    #endif

Example output using the Intel® oneAPI Toolkit Gold release with an Intel C++ Compiler patch release of 2021.1.2:

Windows | Linux
--- | ---
    __INTEL_LLVM_COMPILER: 202110

    __VERSION__: Intel® Clang Based C++, clang 12.0.0
    __INTEL_LLVM_COMPILER: 202110

    __VERSION__: Intel® Clang Based C++, gcc 4.2.1 mode

## Predefined Macros for Intel® C++ Compiler Classic

See the example below using `#if defined(__INTEL_COMPILER)` to define a code block specific to the Intel® C++ Compiler Classic:

    // icc/icpc classic only
    #if defined(__INTEL_COMPILER)
       // code specific for Intel C++ Compiler Classic below
       // ... ...

       // example only
       std::cout << "__INTEL_COMPILER_BUILD_DATE: " << __INTEL_COMPILER_BUILD_DATE << std::endl;
       std::cout << "__INTEL_COMPILER: " << __INTEL_COMPILER << std::endl;
       std::cout << "__VERSION__: " << __VERSION__ << std::endl;
    #endif

Example output using the Intel® oneAPI Toolkit Gold release with an Intel C++ Compiler Classic patch release of 2021.1.2:

Windows | Linux
--- | ---
    __INTEL_COMPILER_BUILD_DATE: 20201208

    __INTEL_COMPILER: 202110
    __INTEL_COMPILER_BUILD_DATE: 20201208

    __INTEL_COMPILER: 2021

    __VERSION__: Intel® C++ g++ 7.5 mode

Parent topic: Macros