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

    Question

  • Hi All

    I am having vc++ project. I am trying to build it as 64 bit using Visual Studio 2010 ultimate trial. But I am getting an error: "module machine type 'X86' conflicts with target machine type 'x64'".

    My machine is Windows 7 (32 bit). And I have installed the 64 bit compiler.

    This project was getting build as both x86 and x64 on Visual Studio 2010 Professional. I am confused.

    I have created a simple win32 console project and tried it to build for 64 bit, but I still get the same error.

    Is there anything else i need to install?

    Thanks & Regards

    Monday, April 16, 2012 10:30 AM

Answers

  • It is a known problem that on occasions VC picks up certain settings from older versions of VC installed and causes these kinds of problems.

    What you should do is reset the settings for Visual Studio.

    Go to Tools->Import and Export Settings and on the wizard that appears select Reset all settings. On the next page choose what you want, and then on the final page, select the settings that you want, and if it offers to allow you to migrate elegable settings from previous versions of Visual Studio, make sure that it is not selected. Then click finish.

    After the VS settings are reset, try creating a new project and seeing how things turn out.

    If this doesn't work, open a Visual Studio command prompt, and on the command line run devenv /ResetUserData then run Visual Studio again. It will be like the very first time you run Visual Studio. Again, choose the environment that you want, and if it gives you the option to migrate elegable settings, make sure you don't. Then try a project again.

    One of these should work, but please note that you must not migrate any settings from previous versions of Visual Studio.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

    • Marked as answer by pk1985 Tuesday, April 17, 2012 4:37 PM
    Tuesday, April 17, 2012 4:10 PM

All replies

  • Double check to see if it really has installed the x64 compilers and tools. I have noticed that occasionally it deselects them under some unknown circumstances.

    Also check to see if the installation hasn't messed up. Go to the VC directory where you installed the ultimate trial and see if under bin a directory named x86_amd64 exists and cl.exe exists under that and under lib a directory named amd64 exists under that and if it is filled with all of the CRT libraries.

    If these exist, the next thing you need to do is give the full error. The conflicting module error should include a module name, could you give that.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.


    • Edited by Crescens2k Monday, April 16, 2012 2:26 PM
    Monday, April 16, 2012 2:25 PM
  • check this link this may help you out

    http://stackoverflow.com/questions/2849517/linking-problem-fatal-error-lnk1112-module-machine-type-x64-conflicts-with-t

    Monday, April 16, 2012 5:27 PM
  • Yes I have double check it. x64 compilers and tools are installed properly. x86_amd64  and amd64  directories exists. And amd64 directories are filled with all CRT libraries.

    What do mean by module name?

    My machine is a 32 bit machine(Win 7).

    The complete error message is given below:

    1>------ Rebuild All started: Project: TestMyDataTypes, Configuration: Debug x64 ------
    1>Build started 4/17/2012 6:18:52 PM.
    1>_PrepareForClean:
    1>  Deleting file "x64\Debug\TestMyDataTypes.lastbuildstate".
    1>InitializeBuildStatus:
    1>  Touching "x64\Debug\TestMyDataTypes.unsuccessfulbuild".
    1>ClCompile:
    1>  stdafx.cpp
    1>  TestMyDataTypes.cpp
    1>Link:
    1>  Microsoft (R) Incremental Linker Version 9.00.21022.08
    1>  Copyright (C) Microsoft Corporation.  All rights reserved.
    1>  
    1>  "/OUT:D:\Projects\TestMyDataTypes\x64\Debug\TestMyDataTypes.exe" /INCREMENTAL:NO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/ManifestFile:x64\Debug\TestMyDataTypes.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:D:\Projects\TestMyDataTypes\x64\Debug\TestMyDataTypes.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:D:\Projects\TestMyDataTypes\x64\Debug\TestMyDataTypes.lib" /MACHINE:X64 x64\Debug\stdafx.obj
    1>  x64\Debug\TestMyDataTypes.obj
    1>x64\Debug\stdafx.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
    1>
    1>Build FAILED.

    Thanks

    Tuesday, April 17, 2012 12:49 PM
  • Well, in this case, module name is stdafx.obj.

    Well, anyway this error is occuring because stdafx.cpp is being compiled with an x86 compiler. If you also notice, the linker that it is executing is version 9.00.21022.08, the version of the linker for VC2010 is

    Microsoft (R) Incremental Linker Version 10.00.40219.01
    Copyright (C) Microsoft Corporation.  All rights reserved.

    So what is happening here is the IDE seems to be using the VC9 tools that are installed on your system. As a bit of a guess, if you checked the VC9 tools, you won't have the 64 bit compilers and tools installed for that.

    So did you set the platform tool set for the project to v90?


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

    Tuesday, April 17, 2012 1:34 PM
  • No my platform toolset is set to v100. And yes VC9 tools that are installed on my system and 64 bit compilers and tools are not installed for that.

    I think there is problem with vc++ directories. For example Library Directories are set as

    C:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB
    C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB
    C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib
    $(VCInstallDir)lib\amd64
    $(VCInstallDir)atlmfc\lib\amd64
    $(WindowsSdkDir)lib\x64

    Should i uninstall vc90 tools or do some other settings so it starts using linker with version 10.00.40219.01?

    Thanks

    Tuesday, April 17, 2012 3:54 PM
  • It is a known problem that on occasions VC picks up certain settings from older versions of VC installed and causes these kinds of problems.

    What you should do is reset the settings for Visual Studio.

    Go to Tools->Import and Export Settings and on the wizard that appears select Reset all settings. On the next page choose what you want, and then on the final page, select the settings that you want, and if it offers to allow you to migrate elegable settings from previous versions of Visual Studio, make sure that it is not selected. Then click finish.

    After the VS settings are reset, try creating a new project and seeing how things turn out.

    If this doesn't work, open a Visual Studio command prompt, and on the command line run devenv /ResetUserData then run Visual Studio again. It will be like the very first time you run Visual Studio. Again, choose the environment that you want, and if it gives you the option to migrate elegable settings, make sure you don't. Then try a project again.

    One of these should work, but please note that you must not migrate any settings from previous versions of Visual Studio.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

    • Marked as answer by pk1985 Tuesday, April 17, 2012 4:37 PM
    Tuesday, April 17, 2012 4:10 PM
  • Thanks a lot. Resetting the user data worked. I followed the second step.
    • Edited by pk1985 Tuesday, April 17, 2012 4:37 PM
    Tuesday, April 17, 2012 4:37 PM