3D Slicer source Build failed in Visual studio 2017 and 2013

Hello
i have a couple of week trying to build 3d slicer in visual studio 2017 and 2013. i tried qt v5.12 but it failed with so many errors. after that tried qt-4.8.7-x64-msvc2013 with vs 2013 x64 build, it was successful but it failed to open Extension Manager in order to install IGT Module.

Software’s Version:
Windows 10 64 bit
3d Slicer 4.10.1

Make sure to follow the build instructions very closely. The document explains what Qt components to install and that for Windows you must use 5.10.x or older versions. You had a lot of errors because you were using 5.12. Qt4 builds are possible, build Qt5 builds are preferred now. Let us know if any instructions need clarification.

If you want to use the IGT module, you can always download the pre-built Slicer versions from the main website and install the extension using the extension manager.

1 Like

In addition note that as a general rule, if you build your own Slicer from source, you won’t be able to add factory-built extensions.

i used cmake 3.11.1 GUI with QT_QMAKE_EXECUTABLE variable set to C:/Qt/Qt5.10.1/5.10.1/msvc2017_64/bin/qmake.exe and configure set to visual studio 2017. cmake failed with this error:
CMake Error at CMake/SlicerBlockFindQtAndCheckVersion.cmake:45 (message):
error: Qt 4.7.4 was not found on your system.You probably need to set the
QT_QMAKE_EXECUTABLE variable.
Call Stack (most recent call first):
CMake/SlicerBlockFindQtAndCheckVersion.cmake:110 (__SlicerBlockFindQtAndCheckVersion_find_qt)
CMakeLists.txt:610 (include)

You’ve overlooked a few instructions. I’ve pointed out some things below which I’ve noticed you’ve done incorrectly. Remember to read the instructions carefully. There are several important steps which if not followed will cause the build to fail with a lot of errors. If there is a specific thing in the instructions that is unclear please let us know so it can be updated. Thanks!

  • Getting the correct Qt5 (msvc 2015 64 bit). See these instructions.
  • For Visual Studio 2017: Make sure you enable installation of component Programming languages / Visual C++ / Common Tools for Visual C++ 2015 (in some distributions, this option is not enabled by default)

  • Visual Studio 2015 toolset must be set in CMake: Optional toolset to use (argument to -T) need to be set to v140

  • Select your compiler: Visual Studio 14 2015 Win64

  • Do not configure yet.

  • Add Qt5_DIR variable pointing to Qt5 folder such as C:\Qt\5.10.0\msvc2015_64\lib\cmake\Qt5 .

using visual studio 2017, even after installing the common tools for visual c++ 2015. cmake doesn’t find the c and cxx compiler corresponding to v140.

This configuration works well for me. You can use commands described at “Visual Studio 2017 with VS2015 toolset in Release mode” on the build instructions page. Make sure to follow all the instructions (correct CMake version, Qt version, etc.).