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

**URL:** <https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669>\
**Category:** Development\
**Tags:** build\
**Created:** [February 7, 2019, 6:12am UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669 "2019-02-07T06:12:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![smaatze](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@smaatze](https://discourse.slicer.org/u/smaatze)\
**Post date:** [February 7, 2019, 6:12am UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669/1 "2019-02-07T06:12:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [February 7, 2019, 6:39am UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669/2 "2019-02-07T06:39:05Z")

</div>

Make sure to follow the [build instructions](https://www.slicer.org/wiki/Documentation/Nightly/Developers/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.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 7, 2019, 12:40pm UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669/3 "2019-02-07T12:40:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![smaatze](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@smaatze](https://discourse.slicer.org/u/smaatze)\
**Post date:** [February 9, 2019, 8:04pm UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669/4 "2019-02-09T20:04:07Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [February 9, 2019, 8:36pm UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669/5 "2019-02-09T20:36:22Z")

</div>

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](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions/Prerequisites/Qt5) 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` .

---

<div class="post-metadata">

**Author:** ![pdeman](https://avatars.discourse-cdn.com/v4/letter/p/9fc348/32.png) [@pdeman](https://discourse.slicer.org/u/pdeman)\
**Post date:** [August 28, 2019, 2:50pm UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669/6 "2019-08-28T14:50:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 28, 2019, 3:02pm UTC](https://discourse.slicer.org/t/3d-slicer-source-build-failed-in-visual-studio-2017-and-2013/5669/7 "2019-08-28T15:02:42Z")

</div>

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](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions). Make sure to follow all the instructions (correct CMake version, Qt version, etc.).
