0
votes

First off, I did already check and found this question which is similar to my issue:

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

The solution there isn't usable though as VS2013 doesn't have the VC++ Directories settings anymore. It looks like those are configured through environment variables now, but I'm not sure how to fix this without borking the 32-bit builds.

====================================

I am working on porting a project from 32-bit to 64-bit code and so I created an x64 platform in my visual studio project. The debug build works fine, but the release build give me this error:

1>MSVCRT.lib(ti_inst.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

Setting the VERBOSE:Lib option, it appears to be trying to find the default system libraries in the x86 paths instead of x64. This pastebin includes the compiler and linker commandlines (yes, this is MACHINE:X64) as well as the VERBOSE:Lib output.

http://pastebin.com/Bqu0udRi

I'd like to know a) how do I fix this, and b) why would this only affect the release build? Looking at the library progress log for the debug build, I can see it is picking up the x64 paths and libraries correctly.

1
It would be useful if that error told you which module it was complaining about.brian beuning
My guess is C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ is not 64-bit code. The VC++ Directories has x86 and x64 settings.brian beuning

1 Answers

1
votes

Perhaps it affect only Release build, because you have different properties set in this build configuration or different property sheets attached.

First of all, open Visual Studio, then go to Property Manager and expand Release | x64 configuration. Check if any other .props are placed above the Microsoft.Cpp.x64.user. If yes, check if they do not overwrite include/library directories.

Also compare what .props are attached in Debug | x64 configuration. Maybe some of them are required but not attached in Release?

If all this is fine, verify Microsoft.Cpp.x64.user itself. Go again to Property Manager, right click it and then Properties -> VC++ Directories. Check if Library Directories entry contains something like:

$(VCInstallDir)lib\amd64
$(VCInstallDir)atlmfc\lib\amd64
$(WindowsSDK_LibraryPath_x64)

The above entries are copied from my x64 .props file.

Lastly, switch to Solution Explorer and then check Project Properties - your project may have defined additional local directories, that are missing in this configuration (or shouldn't be present). Simply compare content in Debug and Release configurations.

Hope this helps.

One more thing:

You may also want to check global macros used by Visual Studio (or, to be more precise, what do they expand to). I ran into very serious problem once, after (with no reason) one of standard directory macro was overwritten to wrong value.