Incorrect build order causes 'Error in opening the compiled module file'

Incorrect build order causes 'Error in opening the compiled module file'

Hi all,

I've encountered a strange compilation error, which my colleagues and I cannot trace down to a user error.

Below is an isolated test problem. It contains a module mf (in mf.f90), which uses module mdm (in mdm.f90).
Unfortunately, a clean build causes mf.f90 to be compiled *before* mdm.f90, so we get:

Compiling with Intel(R) Visual Fortran Compiler XE [IA-32]...
D:\dam_ar\scratch\build_problem\src\mf.f90(2): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MDM]

There's two more files, but they don't seem to be causing problems.

I see no cyclic dependency, so why is the compiler building mdm.f90 *after* mf.f90?

The deps are:

mf uses mdm uses sbm
bcm uses sbm

Here's the four file listings, all are also included in the attachment:

module bcm
use sbm
end module bcm


module mdm
use sbm
end module mdm


module mf
use mdm
end module mf

module sbm
end module sbm

The attachment contains the example files + vfproj+sln for a static library configuration, no user-defined compiler settings that I'm aware of.


Thanks for any help!

Downloadapplication/zip build_problem.zip2.23 KB
10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Sorry, forgot to mention:

The error occurs in Visual Studio 2010 Version 10.0.40219.1 SP1Rel
with Intel(R) Visual Fortran Composer XE 2011 Update 11 Integration for Microsoft Visual Studio* 2010, 12.1.3534.2010

but also in:

Visual Studio 2012 (update 1) with Intel Fortran 13.0 Update 1

And also:

Visual Studio 2012 (update 5) met Intel Fortran 13.1 Update 3

I can reproduce this - and don't see any reason for it. I will send this to the developers for investigation - thanks for the simple example. Issue ID is DPD200250684.

Steve - Intel Developer Support

The cause of this problem is that mdm.f90 has a "byte order mark" (BOM) escape sequence at the start of the file - see screenshot. This doesn't show in the source editor, but it confuses the dependency checker. The workaround is to add a blank or comment line before the MODULE line.

We will fix this for a future release, but you can edit the file to eliminate the problem for now.


Downloadimage/png U496345.PNG4.59 KB
Steve - Intel Developer Support

Interesting catch by Dr. Fortran! The Unix file utility, available as part of Cygwin, says this about the source files extracted from the zip file attached in a post above in this thread:

S:langbuild_problemsrc>file *.f90

	bcm.f90: ASCII text, with CRLF line terminators

	mdm.f90: UTF-8 Unicode (with BOM) text, with CRLF line terminators

	mf.f90:  ASCII text, with CRLF line terminators

	sbm.f90: ASCII text

I can't take credit for this - it was our IDE developers who figured it out.

Steve - Intel Developer Support

The 'best workaround' would probably be to open mdm.f90 in notepad and then do a  'save as' setting the type to ANSI and thus replacing the UTF-8 file with and ANSI version.

OR better, use 'save as' in the VS editor, that has all encoding options also....

Actually ignore that last post if your file actually needs to be UTF-8 because it has not ANSI text, e.g. comments in Japanese!!!!


Thank you, Steve and your team! We'll keep these encoding-rarities in mind to solve future 'mysteries' ourselves.

I expect this to be fixed in Update 2.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today