Slicer build fails cmake error: LNK1112 module machine type 'X86' conflicts with target machine type 'x64'


I am trying to build slicer 4.8 on Windows 7 using:
Visual studio 2013 update 5
CMake 3.10.1
Qt 4.8.7 using easy build option ‘Visual Studio 2013 64-bit Debu
@powershell -Command “$destDir=‘C:\D\Support’;$buildType=‘Debug’;$qtPlatform=‘win32-msvc2013’;$bits=‘64’;iex ((new-object net.webclient).DownloadString(‘’))”

I had to add Visual studio 2013 native command prompt to the Tools menu of VS 2013 following instructions on this link like so:
/k “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat”

Then i set cmake up with the VS 2013 -64 bit c++ toolkit.
Since, i was building for debuggin, I selected cmake-gui option cmake_configuration_types and deleted all types except ‘Debug’, selected the newly built qmake.exe in the previuos step. Then configuration and generation proceeded

Fired up VS 2013, opened Slicer.sln, in the side-bar right clicked ‘Slicer’ and selected option ‘Set as startup project’ and then did Build.

I don’t see where i selected any x86 build in all of this but it crashes with numerous errors starting with the LNK1112 conflict above, mostly with libraries having Qt in them. Any help will be appreciated.

1 Like

Hi @drusmanbashir,

Thanks for reporting the issue.

It looks like you built Qt as a 32-bit libraries. Could you confirm you open and built Qt from a 64-bit windows comment prompt to build it ?

This screenshot illustrates what you should check:


I think that is it! It was indeed an x86 command prompt. I am running the build again and hopefully it will work out this time.

I will intend to build slicer again for release later. Can you also tell me how to choose either a debug or a release build in cmake-gui? The only option i can see remotely related is taking the cmake_configuration_types and deleting all entries except for ‘debug’ (or release if I want a release build - though I havent tried a release build yet)

On windows, you do not select the build type at configuration time. Since IDE like Visual Studio are “multi-configuration”, you will select it from within the IDE.

To avoid ambiguity, you could set the string option CMAKE_CONFIGURATION_TYPES to Release (or Debug) in cmake-gui.

Doing so, will ensure only one option is available in visual studio. Note that it need to match the build type of the selected path for QT_QMAKE_EXECUTABLE

Ok that makes sense. Yes, I will select the relevant qmake (build / release) for the final slicer build. Thanks for sorting this out!

1 Like