Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

Compiling an existing code (error #5102: Cannot open include file 'mpif.h')

nino__jose
Beginner
5,879 Views

Hi Everyone,

I am trying to use Intel® Parallel Studio XE 2019 for Fortran Windows to compile and build a set of existing .f90 files.

When I try to compile the code, I get the next errors:

 - error #5102: Cannot open include file 'mpif.h'

 - error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MSFLIB] 

 - error #6279: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association.   [MPI_STATUS_SIZE]

I am not sure how to inlude 'mpif.h' I read that it is under Tools / Intel Visual Fortran / Compilers. But I still dont know what should I do there to add that include file.
I will apreciate any help, Thanks!

 

Visual and intel versions:

Microsoft Visual Studio Enterprise 2017 
Version 15.8.4
VisualStudio.15.Release/15.8.4+28010.2026
Microsoft .NET Framework
Version 4.7.03056

Intel® Parallel Studio XE 2019 Update 3 Composer Edition for Fortran Windows*   Package ID: w_comp_lib_2019.3.203
Intel® Parallel Studio XE 2019 Update 3 Composer Edition for Fortran Windows* Integration for Microsoft Visual Studio* 2017, Version 19.0.0051.15.

0 Kudos
13 Replies
Ron_Green
Moderator
5,879 Views

You will need to install an MPI package on your system.  The Fortran compiler has the Intel MPI runtime libraries but NOT the include files or libraries needed to build MPI programs.

Intel MPI is one such package.  And now they have a free Community Edition:  https://software.intel.com/en-us/mpi-library/choose-download

 

0 Kudos
Steve_Lionel
Honored Contributor III
5,879 Views

Also, MSFLIB was from Microsoft PowerStation Fortran and Intel Fortran does not provide it. Try replacing that with DFLIB (which is the closest equivalent). 

0 Kudos
nino__jose
Beginner
5,879 Views

Ronald W Green (Blackbelt) wrote:

You will need to install an MPI package on your system.  The Fortran compiler has the Intel MPI runtime libraries but NOT the include files or libraries needed to build MPI programs.

Intel MPI is one such package.  And now they have a free Community Edition:  https://software.intel.com/en-us/mpi-library/choose-download

 

Thanks Ronald! I did not know that. I already installed the MPI package. It solved the first error but I still have the second error:

 - error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MSFLIB] 

0 Kudos
nino__jose
Beginner
5,879 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

Also, MSFLIB was from Microsoft PowerStation Fortran and Intel Fortran does not provide it. Try replacing that with DFLIB (which is the closest equivalent). 

 

Thanks Steve!

You are right, I still have this error:  - error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MSFLIB] 

Do you know how can I replace MSFLIB for DFLIB? just replacing it in the code? (I did not write the code).

0 Kudos
Steve_Lionel
Honored Contributor III
5,879 Views

Yes, just replace MSFLIB with DFLIB wherever it appears.

Alternatively, add the following code as a source file named msflib.f90 to your project:

module msflib
use dflib
end module msflib

 

0 Kudos
nino__jose
Beginner
5,879 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

Yes, just replace MSFLIB with DFLIB wherever it appears.

Alternatively, add the following code as a source file named msflib.f90 to your project:

module msflib
use dflib
end module msflib

 

I just tried both options, and I got this error:

error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [DFLIB] 

it seems that I dont have DFLIB either? do you know how I can include it?

Thanks!

  
 

0 Kudos
Steve_Lionel
Honored Contributor III
5,879 Views

This should work - that module has been provided in every version of Intel Visual Fortran since 8.0. Are you building from within Visual Studio, or some other environment? It sounds as if the INCLUDE path is not properly set.

0 Kudos
nino__jose
Beginner
5,879 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

This should work - that module has been provided in every version of Intel Visual Fortran since 8.0. Are you building from within Visual Studio, or some other environment? It sounds as if the INCLUDE path is not properly set.

Yes, I am building from within Visual Studio. I do not know how to properly set the include path . I tried to do it but I did not find the DFLIB folder, do you have any idea where I can find it?

Thanks!

0 Kudos
andrew_4619
Honored Contributor II
5,879 Views

Well the libs on my system are in 

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.2.185\windows\compiler\lib\ia32_win

The source being in:

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.2.185\windows\compiler\include

However is should just find these if installed OK based on tools>options>Intel Compilers and tools> Visual Fortran

settings in VS

If those are not set OK I suspect your instal is bad

0 Kudos
Steve_Lionel
Honored Contributor III
5,879 Views

In Visual Studio, go to Tools > Options > Intel Compilers and Tools > Visual Fortran > Compilers. Click Reset... Then click on the x64 tab and click Reset... there as well.

If you click on the ... button to the right of Includes it should show (for Win32):

$(UniversalCRTSdkDir)Include\$(UCRTVersion)\um
$(UniversalCRTSdkDir)Include\$(UCRTVersion)\shared
$(IFortInstallDir)compiler\include
$(IFortInstallDir)compiler\include\ia32
$(IFortInstallDir)mkl\include
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\atlmfc\include
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\include
$(WindowsSdkDir)include\um
$(WindowsSdkDir)include\shared
$(FrameworkSDKDir)include

0 Kudos
nino__jose
Beginner
5,879 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

In Visual Studio, go to Tools > Options > Intel Compilers and Tools > Visual Fortran > Compilers. Click Reset... Then click on the x64 tab and click Reset... there as well.

If you click on the ... button to the right of Includes it should show (for Win32):

$(UniversalCRTSdkDir)Include\$(UCRTVersion)\um
$(UniversalCRTSdkDir)Include\$(UCRTVersion)\shared
$(IFortInstallDir)compiler\include
$(IFortInstallDir)compiler\include\ia32
$(IFortInstallDir)mkl\include
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\atlmfc\include
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\include
$(WindowsSdkDir)include\um
$(WindowsSdkDir)include\shared
$(FrameworkSDKDir)include

I just did what you said but I am getting the same error, is there something else I have to modify? (I already found the folder that contains dflib and added in Project - properties - Fortran - General - Additional include directories) this is what it shows and it seems the same as you said: 

$(UniversalCRTSdkDir)Include\$(UCRTVersion)\um
$(UniversalCRTSdkDir)Include\$(UCRTVersion)\shared
$(IFortInstallDir)compiler\include
$(IFortInstallDir)compiler\include\ia32
$(IFortInstallDir)mkl\include
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\atlmfc\include
$(VSInstallDir)VC\Tools\MSVC\$(VCToolsVersion)\include
$(WindowsSdkDir)include\um
$(WindowsSdkDir)include\shared
$(FrameworkSDKDir)include

0 Kudos
Steve_Lionel
Honored Contributor III
5,879 Views

I'd suggest an uninstall and reinstall of the Intel product.

0 Kudos
Leila_Etsa
Beginner
906 Views

Hi,

After installing "Intel Fortran compiler" and "Intel MPI library" you need to put this line in ~/.bashrc in order to define necessary paths and variables:

"source .../setvars.sh > /dev/null". Instead of ... use the path of setvars.sh.

0 Kudos
Reply