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

Link error in Win32 project

New Contributor I

I have a project which has been working fine under x64, now I have a requirement to get it working under Win32.  I have created a new platform Win32 in the sln and vfproj files.  However I keep getting this link error:

dflc.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

if I exclude dflc.f90 from the project, it gives me the same error but with another file and stops.  And so on.  So it's not a problem with the file itself.

However for some reason it is thinking the target machine type is 'x64' whereas I have specified Debug / Win32 as my build configuration.

It is getting x64 from somewhere, but I have no idea where.

MS Visual Studio 2022 17.4.4 / Intel Fortran Version 2021.8.0 Build 20221119_000000

0 Kudos
3 Replies
Honored Contributor III

Have you tried "clean" and building again?

Normally, Visual studio keeps 32-bit and 64-bit objects in different directories, but the user may override the default locations.

You can find if a given OBJ file is a 32-bit or a 64-bit object in a number of ways. One way is to use the command

dumpbin /headers xyz.obj | findstr /i machine
0 Kudos
New Contributor I

Yes, closed VS, relaunch, clean, rebuild.  The Win32 and x64 directories are all separate. The obj file is x86, I did a dumpbin.  The problem is that the link thinks it is targeting a x64 config, which is incorrect.

0 Kudos
New Contributor I

I found the problem.
Properties -> Linker -> Advanced -> Target Machine
It was "Not Set"
I changed to MachineX86.

0 Kudos