# Build Slicer on Windows 10 Failed

**URL:** <https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232>\
**Category:** Support\
**Tags:** qt\
**Created:** [March 2, 2018, 9:29pm UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232 "2018-03-02T21:29:09Z")\
**Posts on this page:** 10\
**Page:** 3

<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:** [July 12, 2018, 1:49pm UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/41 "2018-07-12T13:49:21Z")

</div>

Since it appears you are building Slicer Nightly/Preview, it is probably best to build with Qt5 support even though Qt4 is still technically supported. Build instructions for the Slicer nightly on Windows can be found [here](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Windows).

Also, your QT\_QMAKE\_EXECUTABLE entry was set to “C:/Qt/Qtcreator-2.5.2/bin/qtcreator.exe”. It should be something like “…QT\_DIR/bin/qmake.exe”

---

<div class="post-metadata">

**Author:** ![Mian\_Asbat\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mian\_Asbat\_Ahmad](https://discourse.slicer.org/u/Mian_Asbat_Ahmad)\
**Post date:** [January 25, 2019, 11:01pm UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/42 "2019-01-25T23:01:53Z")

</div>

Hi James and others,  
I followed all the documentation and I am still getting the error.  
I dont know why it is search for old version of qt when we have specified the qt 5.10. Any idea?  
I didnt know this step where we have to QT5\_DIR variable before pressing configure in cmake.  
How can I set it. I added new entry with path option. I believe this is the variable.  
Thanks.

 ![41](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/5/d54d1290467c59f39b938372a7aecd3df1cb28da.png)

---

<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:** [January 25, 2019, 11:26pm UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/43 "2019-01-25T23:26:20Z")

</div>

You also need to set the Qt version to 5.10.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/d/3da0134db063940db4a9368999b7b1e3afc5135e.png)

I haven’t tried lately on windows, but maybe you can just change that through the cmake gui and reconfigure.

Usually I avoid the guis and write a little command line so I can blow away the build directory and get back to a known state if needed.

e.g. here’s a script for building against a homebrow installation of qt on mac.

```auto
cmake \
  -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
  -DSlicer_VTK_RENDERING_BACKEND:STRING=OpenGL2 \
  -DSlicer_REQUIRED_QT_VERSION=5 \
  -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/local/opt/qt5/bin/qmake \
  -DQt5_DIR:FILEPATH=/usr/local/opt/qt5/lib/cmake/Qt5 \
  -DQt5Core_DIR:FILEPATH=/usr/local/opt/qt5/lib/cmake/Qt5Core \
  -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 \
  -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \
  -DSlicer_USE_SimpleITK:BOOL=OFF \
  -DSlicer_USE_QtTesting:BOOL=ON \
  ~/slicer4/latest/Slicer

```

---

<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:** [January 25, 2019, 11:43pm UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/44 "2019-01-25T23:43:56Z")

</div>

Yes @Mian_Asbat_Ahmad, the QT\_QMAKE\_EXECUTABLE entry is for building Slicer with Qt4, so you don’t need anything in that entry if you are going to build with Qt5. If you update the Slicer\_REQUIRED\_QT\_VERSION to 5.10.0, then press Configure, a new entry will appear called Qt5\_Dir and you will specify “C:/Qt/5.10.0/msvc2015\_64/lib/cmake/Qt5”. The latest version for full functionality in a Windows build of Slicer is Qt 5.10 series in which case there is actually a Qt 5.10.1 release you can use. That’s what I’ve been using lately.

This is different advice from [this](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Windows_2) build instructions section. There it mentions “ **Do not configure yet** ”, to manually add the Qt5\_Dir entry, and then configure. Not entirely sure why it is specified in bold to do things in this order, but I find it easiest to do what I suggested above.

---

<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:** [January 26, 2019, 2:12am UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/45 "2019-01-26T02:12:29Z")

</div>

If a build tree is configured with a Qt version then you must build with that version, because any attempt to change to a different one will fail (it will be only partially successful; probably this is a bug in Qt CMake scripts). That is why it is very important to set Qt5\_DIR before you configure the project.

If you have only one Qt version or CMake cannot find an incorrect Qt version then you may specify Qt5\_DIR later, but in general you need to strictly follow the prescribed order.

---

<div class="post-metadata">

**Author:** ![Mian\_Asbat\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mian\_Asbat\_Ahmad](https://discourse.slicer.org/u/Mian_Asbat_Ahmad)\
**Post date:** [January 28, 2019, 10:12am UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/46 "2019-01-28T10:12:12Z")

</div>

Dear team,  
Thank you for your response.  
To clarify I didnt change `Slicer_REQUIRED_QT_VERSION` to 4.7.4. It was automatically picked following the guide.

Okay I am a bit hasty so I tried James suggestions in two steps. I will try CLI after I fixed the cmake-gui.

First I changed the `Slicer_REQUIRED_QT_VERSION` to 5.10.0 and run the configure and I got the following error.

 ![06](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/4/54f16301f9e8f028d2a282e5dcd7a896c530dbfa.png)

I read more and found the second step so I set `QT5_DIR` to `C:/Qt/5.10.0/msvc2015_64/lib/cmake/Qt5` and run configure again. This time the red colour disappeared but I still have a bug. Here is the screenshot.

 ![48](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/5/25768fe57ca5139bd5fda10cd7a17c6e86aae016.png)

Any idea for the new error. Do I have to install curl?

---

<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:** [January 30, 2019, 1:49am UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/47 "2019-01-30T01:49:41Z")

</div>

The error is about not finding `External_curl.cmake` file. It is located in slicer source tree in SuperBuild folder. If it is not there then the cloning of the repository was incomplete. Pull from the Slicer repository again and if you still don’t get the file then clone the repository again.

---

<div class="post-metadata">

**Author:** ![Mian\_Asbat\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mian\_Asbat\_Ahmad](https://discourse.slicer.org/u/Mian_Asbat_Ahmad)\
**Post date:** [January 30, 2019, 10:35am UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/48 "2019-01-30T10:35:19Z")

</div>

@lassoan many thanks, after downloading the project again the error disappeared. It is generated successfully.  
Feedback: It would be very nice to have a separate guide for each major platform stable version windows, mac and linux because for new users like me it was difficult to follow and without your help it wouldn’t be possible.

---

<div class="post-metadata">

**Author:** ![kookoo9999](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kookoo9999/32/12394_2.png) [@kookoo9999](https://discourse.slicer.org/u/kookoo9999)\
**Post date:** [September 17, 2021, 5:54am UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/49 "2021-09-17T05:54:08Z")

</div>

Hello james.  
I wnat to build Slicer ( 4.11 20200930) on Windows10 but build failed repeatedly.  
My env is  
Visual Studio 2017  
Qt 5.10.1(include WebEngine,Script)  
CMake 3.15.0-rc1.

There is no problem with Configuration in CMake(option Visual Studio 2017,x64) and generate too.  
but when I build the ALL\_BUILD in Slicer.sln , I see the Message of Build Fail 48 out of 54 …

And I can’t find Slicer.exe at Slicer\_build\build\ or Slicer\_build.  
Did I do anything wrong?

---

<div class="post-metadata">

**Author:** ![kookoo9999](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kookoo9999/32/12394_2.png) [@kookoo9999](https://discourse.slicer.org/u/kookoo9999)\
**Post date:** [September 17, 2021, 7:27am UTC](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232/50 "2021-09-17T07:27:08Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/6/56e9783aa5c94343599427ea1d3aca16df531be4.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/3/13da421558628a74a7e328d29add67b4a51233c7.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/5/35ed1c844d607d0ee4d4245aedc2c5b5c417ce94.png)

S4R is Slicer-4.11.20200930 source code.  
All\_Build is failed so I can’t find Slicer.exe.  
I tried to build this [link](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/windows.html).

[Previous page](https://discourse.slicer.org/t/build-slicer-on-windows-10-failed/2232.md?page=2)
