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

[Intel Fortran Windows] error 7002: Error in opening the compiled module file. Check INCLUDE paths

andy_in_oxford
New Contributor I
4,551 Views

I am trying to compile a simple program that uses a Fortran module using the Windows Intel Fortran compiler in the Windows command prompt.

In Windows I have already built the module and have the eccodes.mod and the eccodes.lib files. Now I want to compile a simple prorgram that uses this module.

If this was in Linux I would use the command:

ifort -o grib_copy_msg -Ieccodes.f90 -leccodes -ljasper -lpthread grib_copy_msg.f90

What would the Windows equivalent of this be?

All attempts so far have produced the message:

error 7002: Error in opening the compiled module file. Check INCLUDE paths

   use eccodes 

0 Kudos
1 Solution
andy_in_oxford
New Contributor I
4,393 Views

Thanks very much FortranFan and Steve. The solution to this was:

 

ifort grib_copy_msg.f90 /include:<path-to-mod-files> <path_to_lib_files>jasper.lib <path_to_lib_files>eccodes.lib

View solution in original post

0 Kudos
4 Replies
Steve_Lionel
Honored Contributor III
4,522 Views

Where is the .mod for the module it can't find? I don't think you have the Linux command right as one does not use -I to name a specific file.

On Windows, you might do something like this:

ifort grib_copy_msg.f90 /include:<path-to-mod-files> jasper.lib eccodes.lib

You're not using pthreads on Windows, I don't think.

0 Kudos
andy_in_oxford
New Contributor I
4,495 Views

Thanks Steve. I am afraid that doesn't solve it. I am still getting the same error message. The .mod file and .lib file are both in the same directory as the grib_copy_msg.f90. The same place where I am running the compile command from.

Is there any 'verbose' option that I can put in to give more output?

 

0 Kudos
FortranFan
Honored Contributor II
4,450 Views
@andy_in_oxford wrote:
Thanks Steve. I am afraid that doesn't solve it. I am still getting the same error message. The .mod file and .lib file are both in the same directory as the grib_copy_msg.f90. The same place where I am running the compile command from.

Is there any 'verbose' option that I can put in to give more output?

@andy_in_oxford ,

Does the documentation - this, thisthis ,etc. - help?

If not, perhaps you will try a simple test on Windows (since you're coming over from Linux) and see if you can get that to work first?

Say you have a trivial Fortran module with a procedure like so:

module m
contains
   subroutine sub()
   !DIR$ ATTRIBUTES DLLEXPORT :: sub
      print *, "Hello World!"
   end subroutine 
end module 

And say it's packaged a Windows DLL (kinda like shared library on *ux) like so:

C:\Temp>ifort m.f90 /dll
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.29.30038.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:m.dll
-dll
-implib:m.lib
m.obj
   Creating library m.lib and object m.exp

C:\Temp>dir m.*
 Volume in drive C is OSDisk
 Volume Serial Number is E6E8-3C16

 Directory of C:\Temp

07/26/2021  03:10 PM             9,216 m.dll
07/26/2021  03:10 PM               636 m.exp
07/26/2021  02:52 PM               143 m.f90
07/26/2021  02:53 PM             1,630 m.lib
07/26/2021  03:10 PM               290 m.mod
07/26/2021  03:10 PM               981 m.obj
               6 File(s)         12,896 bytes
               0 Dir(s)  201,936,424,960 bytes free

C:\Temp>

Note the mod and lib created by IFORT and placed in the same folder above.

 

Now say you've a caller in p.f90 that consumes the above library:

   use m
   call sub()
end

The program can be built as follows:

C:\Temp>ifort p.f90 m.lib
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.29.30038.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:p.exe
-subsystem:console
p.obj
m.lib

C:\Temp>

 

Upon execution,

C:\Temp>p.exe
 Hello World!

C:\Temp>

 

The documentation linked above would mention how the MOD file in the USE statement is located and how the LIB file is picked up during linking, in this case from the same directory.  You can now "play" with placing the files in different folders and using the options with IFORT to search for them.

 

0 Kudos
andy_in_oxford
New Contributor I
4,394 Views

Thanks very much FortranFan and Steve. The solution to this was:

 

ifort grib_copy_msg.f90 /include:<path-to-mod-files> <path_to_lib_files>jasper.lib <path_to_lib_files>eccodes.lib

0 Kudos
Reply