CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Feb 2008
    Posts
    29

    Angry LNK1112 X86/X64 Mismatch

    I have found a lot of chatter about this, but no final solution that fits my needs. Here is the sequence of actions that lead to the problem.

    1. On my 32-bit XP host, I ran the Visual Studio 2008 upgrade installer over my existing VS 2005 installation. The 2005 installation was left intact. The only options I was offered during installation was to select/deselect VS Basic, VS C++ and VS C#. I installed only C++

    2. I did an update from the MS site, including all available hotfixes.

    3. I imported my existing solutions to 2008.

    4. I tried an initial 32-bit compilation. cl.exe was not found. I set Program Files\Microsoft Visual Studio 9\VC\Bin\x86_amd64 as a path in Executable Files. The only other option is ....\amd64, or one of the VS 2005 compilers.

    5. The 32-bit compilation now compiles but presents LNK1112 module machine type 'x64' conflicts with target machine type 'x86'. The 64 bit compilation proceeds without error.

    6. I researched project configurations and the LNK1112 error postings. The best advice I can find is to reinstall VS2008 and alter my installation settings to X86. But, again, the only installer option is to select or deselect VS C++.

    Can anyone offer any other fixes? I need to compile under at least VS2008, since I am trying to link a Cypress driver that was compiled under 2008 and generates yet another linker error under 2005.

    Thanks for your time

    F.F.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: LNK1112 X86/X64 Mismatch

    Quote Originally Posted by FerroFun View Post
    1. On my 32-bit XP host, I ran the Visual Studio 2008 upgrade installer over mBTWEy existing VS 2005 installation. The 2005 installation was left intact.
    So did you install Visual Studio 2008 over your current Visual Studio 2005? You're saying that Visual Studio 2005 was left intact, but initially you stated you installed over 2005.

    If you did install over VS 2005, then that is a very bad idea. You should never install a later version of Visual Studio over a previous version. Either totally uninstall the previous version, or leave the previous version alone and install the later version in a totally separate directory.

    Edit:

    BTW, I have versions of Visual Studio 2005, 2008, and 2010 on a single machine. All are in separate directories and have no problems in compiling or linking

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; November 10th, 2010 at 12:48 PM.

  3. #3
    Join Date
    Feb 2008
    Posts
    29

    Re: LNK1112 X86/X64 Mismatch

    Sorry... I was a little loose in my terminology. VS 2008 was installed in a completely separate directory. I maintain VS 2005 in its original directory.

    FF

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: LNK1112 X86/X64 Mismatch

    Quote Originally Posted by FerroFun View Post
    Sorry... I was a little loose in my terminology. VS 2008 was installed in a completely separate directory. I maintain VS 2005 in its original directory.

    FF
    Create a simple command-line application and see if that compiles and links.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Feb 2008
    Posts
    29

    Re: LNK1112 X86/X64 Mismatch

    No, a simple "Hello World" produces the same linker error.

    FF

  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: LNK1112 X86/X64 Mismatch

    Quote Originally Posted by FerroFun View Post
    No, a simple "Hello World" produces the same linker error.

    FF
    What are the linker errors?

    Regards,

    Paul McKenzie

  7. #7
    Join Date
    Feb 2008
    Posts
    29

    Re: LNK1112 X86/X64 Mismatch

    The specific error is "fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'.

    I have enabled the startup banner and I get:

    "Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08 for x64".

    As I mentioned in the first entry, there are only two compilers available in the VS 9.0 path and the one that I am using is in the \x86_amd64 path, not the \amd64 path. The other compiler selection fails to spawn the compiler on my 32-bit XP host. It is as though the upgrade package did not install an X86 compiler. Perhaps that is the answer - I purchased the wrong package.

    FF.

  8. #8
    Join Date
    Apr 1999
    Posts
    27,449

    Re: LNK1112 X86/X64 Mismatch

    Quote Originally Posted by FerroFun View Post
    The specific error is "fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'.
    Ah. OK.

    The solution should be simple. You have a project that has mixed up 64-bit and 32-bit settings. Are you building a 64-bit app or 32-bit app?

    Regards,

    Paul McKenzie

  9. #9
    Join Date
    Feb 2008
    Posts
    29

    Re: LNK1112 X86/X64 Mismatch

    Sorry for the delay... This will probably be my last post for the day...

    I am trying to build a 32-bit app. The 64-bit build works without error. For some reason, my installation did not provide the 80x86 compiler, it seems. I need to figure out how to get that version installed on my host. I need to see:

    "Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86"

    in my banner, it seems.

  10. #10
    Join Date
    Feb 2008
    Posts
    29

    Re: LNK1112 X86/X64 Mismatch

    BTW, nothing in the project settings - C++ or linker - seem to relate to this. The linker has the Target Machine set to /MACHINE:X86. It appears that it doesn't like the apparent fact that the object file was compiled for 64 bit.

  11. #11
    Join Date
    Apr 1999
    Posts
    27,449

    Re: LNK1112 X86/X64 Mismatch

    Quote Originally Posted by FerroFun View Post
    Sorry for the delay... This will probably be my last post for the day...

    I am trying to build a 32-bit app. The 64-bit build works without error. For some reason, my installation did not provide the 80x86 compiler, it seems. I need to figure out how to get that version installed on my host.
    Is your Configuration Manager -> Active Solution Platform set for the right type? It should be "Win32" or something equivalent to that, not "x64" or some other value.

    Regards,

    Paul McKenzie

  12. #12
    Join Date
    Feb 2008
    Posts
    29

    Re: LNK1112 X86/X64 Mismatch

    Sorry for the delay in posting. I was out of the office yesterday.

    Yes, my configuration manager has the Active Solution Platform set to Win32. When it is set to X64 the compilation is successful. I think that this issue is semi-resolved. I believe I am invoking the wrong compiler. I do not seem to have the right compiler (80x86) installed. Apparently the standard edition of the VS 2008 upgrade installer does not offer it. I need to figure out how to get a copy.

    Thanks for your attention to this question.

    FF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured