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

LNK1112 x64 x86 - how to set target machine to x64

I_D_
Beginner
1,400 Views

Hi,

I'm building a Fortran project and get an error "LNK1112: module machine type 'x64' conflicts with target machine type 'X86'" I want to have the project built for 64-bit. I'm using Intel® Parallel Studio XE Composer Edition for Fortran with Rogue Wave IMSL 7.0 for Windows.

I also added paths to includes and libraries as recommended here https://software.intel.com/en-us/articles/installing-and-using-the-imsl-libraries/ 

In Configuration Manager Active solution platform is x64.

In the Linker->Advanced->Target Machine is "Not Set"

What could cause this error? 

Thank you

0 Kudos
12 Replies
I_D_
Beginner
1,400 Views

Forgot to mention - Visual Studio 2015

0 Kudos
Steven_L_Intel1
Employee
1,400 Views

Look at the Linker > Command Prompt property page and see if /machine is specified under "Additional Options". This sometimes happens with projects that were converted from Compaq Visual Fortran (since that option was set there.) If it is there, remove it.

0 Kudos
I_D_
Beginner
1,400 Views

Thank you, Steve.  Linker > Command Line >Additional Options was empty. "All Options" was empty as well. 

0 Kudos
Steven_L_Intel1
Employee
1,400 Views

Please attach a ZIP file with: your Solution (.sln) and Project (.vfproj) files as well as the buildlog.htm from the failing build. If you are really building an x64 configuration, this would typically be in x64\Debug or x64\Release. When I look at those I may be able to identify the problem.

Do be sure that the "Solutions Platform" dropdown in the VS toolbar says x64 and not Win32. Also double-check Build > Configuration Manager for your x64 Solution Platform to be sure that the Platform for the project is set to x64.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,400 Views

In earlier versions of MS VS I've noticed in a 64-bit solution that at times if you add a project to a solution that has other projects in 64 bit (main solution toolbar pull-down has x64 selected), the newly added project can come in with only Win32 builds enabled. IOW when opening the Project Build properties, you will not have the x64 configuration listed. This is just one of those quirks that you get used to.

Jim Dempsey

0 Kudos
I_D_
Beginner
1,400 Views

Steve Lionel (Intel) wrote:

Do be sure that the "Solutions Platform" dropdown in the VS toolbar says x64 and not Win32. Also double-check Build > Configuration Manager for your x64 Solution Platform to be sure that the Platform for the project is set to x64.

Thank you, Steve

I checked the second option Build > Configuration Manager and the solution platform is x64. Also I see the "x64"  is a small window on the toolbar, I guess this is the first thing you mention.

I'll ask the permission of the code owner to publish it (the code isn't mine).

I also got advice that I "have to rebuild all of the libraries you link to target x64". Do you think this can help? If yes, what should I do in order to rebuild them?

 

 

 

0 Kudos
Steven_L_Intel1
Employee
1,400 Views

I don't want to see the code, just the project and solution files as well as the buildlog.htm. There's no code in those. No, I don't think that advice will help. The issue is that the project thinks that the executable target platform is x86. 

0 Kudos
I_D_
Beginner
1,400 Views

jimdempseyatthecove wrote:

In earlier versions of MS VS I've noticed in a 64-bit solution that at times if you add a project to a solution that has other projects in 64 bit (main solution toolbar pull-down has x64 selected), the newly added project can come in with only Win32 builds enabled. IOW when opening the Project Build properties, you will not have the x64 configuration listed. This is just one of those quirks that you get used to.

Jim Dempsey

Thank you, Jim

I didn't modify the project in any way. It worked as is on the same system (Studio XE Composer Edition for Fortran with Rogue Wave IMSL 7.0 for Windows + VS 2015) on another desktop. The only difference in OS. The project builds correctly on Win7, but I have Win 8.1

It seems that the settings of the system cause the problem, not the project itself. 

 

0 Kudos
I_D_
Beginner
1,400 Views

Steve Lionel (Intel) wrote:

I don't want to see the code, just the project and solution files as well as the buildlog.htm. There's no code in those. No, I don't think that advice will help. The issue is that the project thinks that the executable target platform is x86. 



Please see the files enclosed 

0 Kudos
Steven_L_Intel1
Employee
1,400 Views

Thanks.

Your X64>Debug configuration has 

/MACHINE:I386 

in Additional Options for the linker. That's the main issue.

0 Kudos
I_D_
Beginner
1,400 Views

Steve Lionel (Intel) wrote:

Thanks.

Your X64>Debug configuration has 

/MACHINE:I386 

in Additional Options for the linker. That's the main issue.

 

Thank you, Steve, this helped. 

0 Kudos
Steven_L_Intel1
Employee
1,400 Views

That was what I asked you to check in my first reply, though. Maybe you didn't look at the configuration that was giving you problems.

0 Kudos
Reply