Using Predefined Preprocessor Symbols for Intel® MKL Version-Dependent Compilation

Preprocessor symbols (macros) substitute values in a program before it is compiled. The substitution is performed in the preprocessing phase.

The following preprocessor symbols are available:

Predefined Preprocessor Symbol



Intel MKL major version


Intel MKL minor version


Intel MKL update number


Intel MKL full version in the following format:


These symbols enable conditional compilation of code that uses new features introduced in a particular version of the library.

To perform conditional compilation:

  1. Depending on your compiler, include in your code the file where the macros are defined:

    C/C++ compiler:


    or mkl.h, which includes mkl_version.h

    Intel® Fortran compiler:

    Any Fortran compiler with enabled preprocessing:


    Read the documentation for your compiler for the option that enables preprocessing.

  2. [Optionally] Use the following preprocessor directives to check whether the macro is defined:
    • #ifdef, #endif for C/C++
    • !DEC$IF DEFINED, !DEC$ENDIF for Fortran
  3. Use preprocessor directives for conditional inclusion of code:
    • #if, #endif for C/C++
    • !DEC$IF, !DEC$ENDIF for Fortran


This example shows how to compile a code segment conditionally for a specific version of Intel MKL. In this case, the version is 11.2 Update 4:

Intel® Fortran Compiler:

include ""
*       Code to be conditionally compiled 

C/C++ Compiler. Fortran Compiler with Enabled Preprocessing:

#include "mkl.h"
#if INTEL_MKL_VERSION ==  110204
...     Code to be conditionally compiled
For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)