4
votes

I'm using cmake-2.8.9-win32-x86. I wanted to build Qt qt-win-opensource-4.8.2-vs2010 on visual studio 2010. My computer has 64 bit system. I think since either cmake or qt is x86 I'm taking this error while building. LNK1112 module machine type 'X86' conflicts with target machine type 'x64'.

How to fix this?

1
how can I change the platform as told there?TahaYusuf
You fix this by only letting CMake find the correct Qt you are targeting your build for. I mean if you selected a 64 bit build in CMake make sure it did not find a 32 bit Qt in your paths. That will not work. On windows I avoid this issue by keeping my 32 bit builds and 64 bit builds in completely separate trees and I also open an environment with QTDIR set to the path I want CMake to find.drescherjm
Thanks :) Actually I could not find 64 bit Qt in my file and find any download link which contains 64 bit files. Or could you please tell me how I can change my machine type?TahaYusuf
In cmake-gui reset your cache and then do not select Visual Studio 2010 Win64 as the generator type. Instead pick just Visual Studio 2010drescherjm

1 Answers

4
votes

The error is telling you that the linker has been run with a target that specifies x64 while the module the linker is reading was created for x86. What's wrong depends on what you are trying to do.

If you are trying to create an x64 code file then the linker target is correct and the module is wrong. If you are trying to create an x86 code file then the linker target is wrong and the module is correct.

Whichever item is wrong is the one you have to correct - either by changing the linker target or by changing the module. If the module is wrong you probably ended up compiling it with the x86 version of the compiler rather than the x64 version.