Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Error compiling sample FFT


Hi all,

I am quite new to intel MKL, so please correct me if I am posting this to the wrong forum etc.
I want to use the intel MKL FFT library in Fortran 95. I am working with the eclipse IDE with a gfortran compiler on windows 10 with cygwin.

Following the instructions of this
page (I know its for c/c++) I included the "include" and "lib\intel64_win" directory to the "Project Properties->Fortran General->Paths and Symbols->Includes->Fortran Source File" list.
In the "...->Paths and Symbols->Libraries", the libraries "mkl_intel_lp64", "mkl_intel_thread" and "mkl_core" are listed.

The Source code is copied from here ;
the only change I made, was writing "implicit none" after "USE MKL_DFTI":

program InteltestFFT

    ! Fortran example.
! 1D complex to complex, and real to conjugate-even
    implicit none
Complex :: X(32)
Real :: Y(34)
type(DFTI_DESCRIPTOR), POINTER :: My_Desc1_Handle, My_Desc2_Handle
Integer :: Status
!...put input data into X(1),...,X(32); Y(1),...,Y(32)

! Perform a complex to complex transform
Status = DftiCreateDescriptor( My_Desc1_Handle, DFTI_SINGLE,&
  DFTI_COMPLEX, 1, 32 )
Status = DftiCommitDescriptor( My_Desc1_Handle )
Status = DftiComputeForward( My_Desc1_Handle, X )
Status = DftiFreeDescriptor(My_Desc1_Handle)
! result is given by {X(1),X(2),...,X(32)}

! Perform a real to complex conjugate-even transform
Status = DftiCreateDescriptor(My_Desc2_Handle, DFTI_SINGLE,&
   DFTI_REAL, 1, 32)
Status = DftiCommitDescriptor(My_Desc2_Handle)
Status = DftiComputeForward(My_Desc2_Handle, Y)
Status = DftiFreeDescriptor(My_Desc2_Handle)
! result is given in CCS format.

end program InteltestFFT


Compiling this program gives the following error (198 errors, slightly differing in the parenthesis after mkl_core.lib):

Description    Resource    Path    Location    Type
undefined reference to `__GSHandlerCheck'    TestMklFFT2D        line 0, external location: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\lib\intel64_win\mkl_core.lib(_avx2_bkd1_c.obj)    C/C++ Problem


In a userguide (unfortunately for Linux) on page 5-7 it is mentioned, that the -lm command should be used for linking. However, doing this leads to another error which gives no information:

Description    Resource    Path    Location    Type
TestMklFFT2D] Error 1    TestMklFFT2D        line 31    C/C++ Problem

Line 31 is the line after the "end program InteltestFFT" command.


Does somebody know the reason for this error or did encounter the same error?

Best regards

0 Kudos
7 Replies

Hi Christoph,

You may take a look at the online link tool to check the needed libraries and compiler options. Or, you may run C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_*.*.*\windows\mkl\tools\mkl_link_tool.exe to see what libraries are needed for your application.


pls pay attention - you use gfortran, therefore select -lmkl_gf_lp64 instead of mkl_intel_lp64



Thank you for the fast answers :)
I tried both, the online link tool which recommends the following:

"Use this link line:
mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib"

"Compiler options:

The options I used were MKL 2017.0->Windows->None->PGI Fortran(as no gfortran was available)->Intel 64->Static->32 Bit integer->Sequential. No other options were chosen.

Using the installed linking tool "mkl_link_tool.exe" (as it supports the gfortran compiler option) does result in the following output

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\tools>mkl_link_tool -opts gfortran

       Intel(R) Math Kernel Library (Intel(R) MKL) Link Tool v4.3

Not supported compiler for current configuration:gnu_f. Supported values for compiler: intel_c|intel_f|ms_c|pgi_f|pgi_c


MKL version:            2017.1
OS:                     win
Architecture:           intel64
Compiler:               gnu_f
Linking:                dynamic
Interface layer:        lp64
Parallel:               yes
OpenMP library:         iomp5

Does this mean that gfortran is not supported at all?

I also tried to substitute the mkl_intel_lp64 by mkl_gf_lp64. However, there is no such file in my lib directory.

I'm also a bit confused about the mkl_dfti.mod, mkl_dfti.o and mkl_dft_type.mod files that were generated by compiling mkl_dfti.f90.
Previously I have always been linking to .a libraries. Is there any difference on how the libraries need to be passed to the compiler? Just indicating it as library results in the following errors (above mentioned libraries mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib were used):

Description    Resource    Path    Location    Type
cannot find -lmkl_dfti    TestMklFFT2D             C/C++ Problem
TestMklFFT2D] Error 1    TestMklFFT2D        line 31    C/C++ Problem

The paths to the libraries are specified in environment variables and the photran IDE. (->Properties->Fortran Build->Settings->Tool Settings->GNU Fortran Linker->Libraries->library search path(-L).

Does a switch to the intel compiler make things easier? Can the intel compiler be used with other IDEs than VS?


Hi Christoph, 

I think the problem is your special environment :  gfortran compiler on windows 10 with cygwin, which we don't support.   Also we don't support gfortran under Windows, 

Regarding the `__GSHandlerCheck' itself, there is some information in internet, it may be defined from libcmt.lib, which is supposed to link with MSVC library.  If your cygwin system have that, you may add it. But i guess there will have following errors as unsupported system.  

So i may suggest, if possible, use supported compiler and developer environment. for example,  If you install Intel fortran Compiler for windows version, you are supposed to build the fortran 95 application directly (don't need Cygwin). 

FYI, MKL system requirements:

Best Regards,





 Hi,i am a new student .

can you tell me how to find a  FFT example coded by C or C++?  



Hi Ying,

Thank you for your comment.
I was switching to VS with the ifort compiler right after my comment on the 29th of november. This solved my problem instantaneously.

Best Regards


Hi Christoph,

Glad to know you work around it.  thanks for the sharing.

Hi Qing,

You may find MKL example in MKL install folder or search in the forum:  for example, some in

Best Regards,