How to Build an Intel® MKL Application with Intel® Visual Fortran Compiler

This document describes the steps to build an Intel® MKL application with Intel® Visual Fortran Compiler XE for Windows* OS integrated with Microsoft Visual Studio* 2013

Software Requirement:

1. Intel® Visual Fortran Compiler XE for Windows* OS 15.0 or a later version
    The compiler must be installed and integrated correctly with Microsoft Visual Studio* 2013.

2. Intel® MKL 11.2 or a later version
    Intel® MKL is included in the Intel® Parallel Studio XE suite. 

3. Microsoft* Visual Studio 2013  

Step 1:  Select whether you are building  IA-32 or Intel® 64 application
Based on the target machine your application will run on, select:

IA-32: 32-bit application for IA-32 architecture
IA-64: 64-bit application for Intel® 64 architecture

For more information about IA-32 and Intel® 64 architectures, see this article.

When building IA-32 or IA-64  application within Microsoft VS* environment, check the Build→Configuration manager→ Active solution platform setting.  It should be either “Win32" or "X64" (which corresponds to Intel® 64).

Step 2: Select the libraries to link from  Intel® MKL 
Use the on-line Intel® Math Kernel Library Link Line Advisor to determine which libraries your application needs to link to, based on your platform settings.

Intel® Math Kernel Library Link Line Advisor will list the libraries you need to link to from Intel® MKL

IA-32 Windows* application:
"mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib" are common libraries

Intel® 64 Windows* application: "mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib"

Step 3: How to link to Intel® MKL manually in your project
Follow these steps to add the include path, library path and Intel® MKL libraries listed by the Intel® Math Kernel Library Link Line Advisor.  

1. To add the include path manually refer to the MSVS* screenshot below. Open Project → Property Pages →Fortran →General. Type/Paste the library directory in the 'Additional Include Directories' field.

2. To add the library path manually refer to the MSVS* screenshot below. Open Project → Property Pages → Linker →General. Type/Paste the library directory in the 'Additional Library Directories' field.

Make sure to check the library path and enter the correct directory:

<MKL install dir>\ia32,  for IA-32 application
<MKL install dir>\intel64, for x64 application                                                                                                                                              

3. To add  the required libraries manually refer to the MSVS* screenshot below. Open Project → Property Pages → Linker → Additional Dependencies. Paste the libraries from the Intel® Math Kernel Library Link Line Advisor.

Step 4: Link to Intel® MKL in your project automatically - quick option (optional)

Note: Step 4 (optional) and the Step 3 are equivalent in most cases. Be sure to use only one of these options, don’t mix them. 

The latest Intel® MKL versions have a single 'Build' menu in MSVS* environment. Refer to the MSVS* screenshot below. Open Project → Property Pages →Fortran → Libraries →Use Intel Math Kernel Library. Select the desired option, such as /Qmkl:parallel or /Qmkl:sequential. Once selected all of environment settings and required libraries are ready for your project. Proceed to build and run the application.


Code Sample:

The attached zip file contains a MSVS* 2013 project (Intel® Visual Fortran Compiler XE for Windows* OS IA-32 application) for your reference. does Real 1d DFT.


  1. Some interface libraries (i.e. mkl_lapack95.lib mkl_blas95.lib fftw3xc_ms) are not Intel® MKL standard libraries, as such "Step 4 - quick option" does not support them.  You can add those libraries manually if you need to use them.


You may encounter the following errors when building the project:

1. "fatal error LNK1104: cannot open file 'mkl_xxx.lib'"
    Make sure the library is included in the library path and the path you enter in step 3 or step 4 is correct.

2. "error #7002: Error opening the compiled module file.  Check INCLUDE paths. [MKL_DFTI]."                                                        Add the header file mkl_dfti.f90 in your code, for example:

! Include to build module MKL_DFTI
INCLUDE 'mkl_dfti.f90'

before the code line

Alternatively, copy the mkl_dfti.f90 file to your project's source directory and include it in your project. 

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.