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

LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

Julian_H_
Beginner
1,833 Views

Hello,

a top which was already discussed a few times but the current threads could not help me. I am trying to create a x64 configuration but I am getting the mentioned error. What I did so far and specifics:

  • VS 2015
  • Intel Fortran 18.0.5

 

  • Build a Minimal test system x64 -> it is build and running flawlessly (x64 Compiler correctly installed)
  • Checked in the configuration that all projects have the x64 configuration for the x64 *.sln
  • Checked that there is no /MACHINE:I86 or similar in the "addional options" area in the linker section
  • Checked that in the linker settings "Target Machine" is set to "Not set"
  • C++ lib: Librarian; TargetMaschine /MACHINE:X64
  • The *.exe which should be builded: "Additonal dependencies" "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"

What keeps me wondering that the File which is causing the error is looking for a object file MyC++Lib(hlmscffs.obj) which I do not know and which is also not in any of my x64/Debug folders.

Any has an Idea?

0 Kudos
8 Replies
Johannes_Rieke
New Contributor III
1,833 Views

Hi Julian, in case that you build with VS: the *.vfproj file sometimes gets mingled and the configuration is mixed x86 win32/ x64. Have you checked this? I had this some times for solutions with different projects, where I had created a new x64 configuration from x86 win32 configuration.

edit: Jim is right. It has to be win32 instead of x86. Sorry for confusion.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,833 Views

Microsoft Visual Studio has Platform selections of x86 (Mixed Platforms), Win32 (IA32), and x86 (Intel64)

Intel Fortran can target  Win32 (IA32), and x86 (Intel64), but not a mixed platform. A Mixed Platform (x86) generates code that can run on both platforms.

Change your Platform selection (add a platform) to x64

If you Google, with quotes "MyC++Lib", you get 4 hits, two of which reference Microsoft platforms, both of which indicate MyC++Lib is a Managed C++ build (which, in your case, may have been built as x86/Mixed Platform).

You have two potential solutions:

1) Locate an x86 build version of MyC++Lib, and if necessary, add C stub functions that call the C++ name mangled functions
2) Or, add C stub functions that call the Managed C++ name mangled functions

Check this link: https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-calling-subprograms-from-the-main-program-windows

Jim Dempsey

0 Kudos
Julian_H_
Beginner
1,833 Views

jimdempseyatthecove wrote:

Microsoft Visual Studio has Platform selections of x86 (Mixed Platforms), Win32 (IA32), and x86 (Intel64)

Intel Fortran can target  Win32 (IA32), and x86 (Intel64), but not a mixed platform. A Mixed Platform (x86) generates code that can run on both platforms.

Change your Platform selection (add a platform) to x64

If you Google, with quotes "MyC++Lib", you get 4 hits, two of which reference Microsoft platforms, both of which indicate MyC++Lib is a Managed C++ build (which, in your case, may have been built as x86/Mixed Platform).

You have two potential solutions:

1) Locate an x86 build version of MyC++Lib, and if necessary, add C stub functions that call the C++ name mangled functions
2) Or, add C stub functions that call the Managed C++ name mangled functions

Check this link: https://software.intel.com/en-us/fortran-compiler-developer-guide-and-re...

Jim Dempsey

MyC++Lib is a placeholder for my actual lib. I am building this lib myself. Sorry for the confusion.

 

I am also adding different other libs which I mentioned before (kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib) but from what I read those have the same name like there WIN32 Version but they are taken from SysWOW64 instead from System32. So here should lay the problem if I am not mistaken.

 

I was looking into the buildlog and realised that in addition to MyC++lib an other lib is added, It was not added with the help of the project Properties > Linker > Input > Additional Dependencies instead it was laying in the "Source Files" folder of a project so I did not see it in the first place. The name is indicating it is a WIN32 lib.

 

I dont understand what you mean by 

Intel Fortran can target  Win32 (IA32), and x86 (Intel64)

You mean when I have a x64 Fortran I can link to a x64.lib and when I have a x86 Fortran I can link to a x86 lib?

0 Kudos
gib
New Contributor II
1,833 Views

I think Jim meant to write:

"Microsoft Visual Studio has Platform selections of x86 (Mixed Platforms), Win32 (IA32), and x64 (Intel64)

Intel Fortran can target  Win32 (IA32), and x64 (Intel64), but not a mixed platform."

The libraries must be consistent, i.e. Win32 libraries for a program built with Win32, x64 libraries for a program built with x64.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,833 Views

Additional info:

SysWOW64 and Program Files (x86) are special folders that only exists on 64-bit Windows and they are intended to store 32-bit binary files. In the folder names there are the "strange" character combinations WOW64 and x86 included

Meaning, if you are building an x64 Fortran program, then link the external .lib files from the System32 folder tree.

Jim Dempsey

0 Kudos
FortranFan
Honored Contributor II
1,833 Views
0 Kudos
Steve_Lionel
Honored Contributor III
1,833 Views

None of the libraries you would link in are provided in a Windows system folder. Compiler libraries will all be under IntelSwTools, a Microsoft Visual Studio folder, or a Windows Kits (SDK) folder. SysWow64 and System32 folders should not be involved.

The error here indicates a mix of platform types, as noted. Often this happens when you link in some third-party library or object file that is for the wrong platform.

I have also seen this happen with multi-project solutions where, under Configuration Manager, the projects aren't all set to the same platform in the configuration.

0 Kudos
Julian_H_
Beginner
1,833 Views

Thanks to all for your help.

Steve Lionel (Ret.) wrote:

None of the libraries you would link in are provided in a Windows system folder. Compiler libraries will all be under IntelSwTools, a Microsoft Visual Studio folder, or a Windows Kits (SDK) folder. SysWow64 and System32 folders should not be involved.

thanks for clarification

Steve Lionel (Ret.) wrote:

The error here indicates a mix of platform types, as noted. Often this happens when you link in some third-party library or object file that is for the wrong platform.

yes that was the problem

Steve Lionel (Ret.) wrote:

I have also seen this happen with multi-project solutions where, under Configuration Manager, the projects aren't all set to the same platform in the configuration.

This I made sure from the beginning that everything was matching.

 

0 Kudos
Reply