Showing results for 
Search instead for 
Did you mean: 

How to compile the sample code in minGW complier?

Hi all,

I am using minGW as the compiler and our code has a lot of FFT. In the past we use fftw and we want to try Intel's fft to improve it. 

I download the trial version of the MKL and install it on my computer (64 bit Windows 8). I also download the first sample code from the website. (

However, I don't know how to compile it in minGW. In the pass, we just input in the windows command window: gfortran -o test.exe -O2 testfortran.f -LC:\\Windows\system -lfftw3-3. This can link our code to the fftw's fft library. But I don't know how to link the code to the new library in minGW compiler. 

Could some please tell me where I've made a mistake? We appreciate your help.

We just want to do the forward and backward fft. If there is an easy example of Fortran code just tells us how to use the Intel's forward fft and backward fft, it would be very helpful. 

Best regards,

0 Kudos
2 Replies
Black Belt

Intel provides makefiles for building FFTW wrapper libraries. I have not gone through the exercise with MINGW (which I do not use), but here is what you probably have to do:

  • if the wrapper libraries have not been built earlier, do so using the sources and makefile provided by Intel, and your Fortran compiler
  • build your application, linking with the wrapper library just built and the MKL libraries, consulting the MKL Link Line Advisor if necessary.
Black Belt

You haven't shown what happened, so I will summarize some expected issues in this unsupported scenario.

find the source code use_mkldfti.f90 and compile that with your mingw compiler.  The mingw module format will depend on your gfortran version and will not be compatible with the ifort one which may be supplied with MKL.

match your mingw installation to MKL library (Intel64 Windows library for X64).

check the symbols in the MKL library; they are probably upper case; if so, you could add iso_c_binding to specify the function name spellings for the link symbols.

check the name of the MKL .lib; it's unlikely to be spelled the way you show.   I don't know whether adding a symlink to make the .lib appear as libfftw3-3.a has a chance of working. Choosing the linux library simply because the name matches your expectation is a non-starter, as mingw ld won't understand the linux file format.

You would need to consult the MKL link advisor, as mecej4 said, choosing the sequential linkage, unless you can find a way to build the Intel open source OpenMP library compatible with mingw and MKL.  I've looked at it; the build scripts insist on using Intel compilers when they find out you're on Windows.

You may need to find an expert on mingw-64 to answer further questions.  The lack of web search references on this subject probably means something.