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

Static Lib, This module...different platform

jimdempseyatthecove
Honored Contributor III
732 Views

Using VS 2013 with Intel PS 2015 update 4. x64 Release Build

Have static library project (all Fortran), and a "main" Fortran program that uses the library. The library builds without error.

The library, in addition to .obj and .lib files, produces a .mod, which is intended to be used by the "main" Fortran program. When I use (intend to use) the library produced .mod file (located in the .../x64/Release folder of the library project) I get:

This module file was generated for a different platform or by an incompatible compiler or compiler release.

Copying the .mod file to the input folder of the "main" produces the same symptom.

If I remove the project dependency to the library project from the "main" and delete the .mod file (from both locations), I get:

Error in opening the compiled module file.

If add back the project dependency to the library project from the "main" project, rebuild the Library project (to generate the .mod file), then I get the compatibility error message. This illustrates I do not have a path mix-up to different compiled versions.

Both builds are x64 Release.

Also, the build log (with dependency reset)

ifort /nologo /O2 /I"C:\SolutionDir\LibProjectDir\Win32$\(Configuration)"
 /I"C:\SolutinDir\LibProjectDir\x64\Release"
 /module:"Release\\"
 /object:"Release\\"
 /Fd"Release\vc120.pdb"
 /libs:dll
 /threads
 /c
 /Qvc12
 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\\bin"
 "C:\SolutionDir\MainProjectDir\file.f90"
C:\SolutionDir\MainProjectDir\file.f90(2): error #7881:
 This module file was generated for a different platform or by an incompatible compiler or compiler release.
 It cannot be read.   [MY_MODULE]
use my_module

Now, why does /module:, and /object: have "Release\\" instead of "x64\Release"?

Note, both are generated into the "x64\Release" folder.

Jim Dempsey 

0 Kudos
3 Replies
Steven_L_Intel1
Employee
732 Views

The fact that /module points to the 32-bit folder is a clue., You should open the Configuration Manager to make sure that all the projects in your configuration have x64 set as the platform.

0 Kudos
jimdempseyatthecove
Honored Contributor III
732 Views

By the way, the command line property page shows:

/nologo /O2 /I"C:\SolutinDir\LibProjectDir\x64\Release" /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc120.pdb" /libs:dll /threads /c

IOW shows with the "x64".

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
732 Views

That fixed the problem.

It is odd, to say the least, that you can use the configuration manager add x64 (from Win32)...

See and select the platform and configuration (Release, x64).

Perform the build (of the library) no errors. and See the files

Perform the  (Release, x64) of the "main" (getting errors).

It seems to me that the configuration manager should grey out the selections if the build box isn't set.

While this is an MS issue (and user issue), it would be helpful if ifort could issue a more meaningful message when it sees a mixup of options.

Thanks for the pointer. And the speedy response.

Jim Dempsey

0 Kudos
Reply