# Error during generation with Visual Studio

**URL:** https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345
**Category:** Development
**Created:** [May 9, 2022, 1:02pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345 "2022-05-09T13:02:17Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Shoshoda](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Shoshoda](https://discourse.slicer.org/u/Shoshoda)
#### Post date: [May 9, 2022, 1:02pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/1 "2022-05-09T13:02:17Z")

</div>

Hello everyone,  
I’m new to 3d slicer so maybe I’m doing it wrong but this is the error I get :

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

I tried several time to build the project with CMAKE and Visual Studio on two differents computers(Windows 10 and 11)

Regards,  
Michael

---

<div class="post-metadata">

### Author: ![Shoshoda](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Shoshoda](https://discourse.slicer.org/u/Shoshoda)
#### Post date: [May 9, 2022, 1:04pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/2 "2022-05-09T13:04:57Z")

</div>

Hello everyone,  
I’m new to 3d slicer so maybe I’m doing it wrong but this is the error I get :

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

I tried several time to build the project with CMAKE and Visual Studio on two differents computers(Windows 10 and 11)

Regards,  
Michael

---

<div class="post-metadata">

### Author: ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)
#### Post date: [May 9, 2022, 3:52pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/3 "2022-05-09T15:52:37Z")

</div>

@Shoshoda are you getting only, this ONE error?

---

<div class="post-metadata">

### Author: ![Shoshoda](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Shoshoda](https://discourse.slicer.org/u/Shoshoda)
#### Post date: [May 9, 2022, 4:29pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/4 "2022-05-09T16:29:15Z")

</div>

Yes only this one, on both computer

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [May 10, 2022, 8:50am UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/5 "2022-05-10T08:50:01Z")

</div>

Still, this is very little information. A full log would definitely help.

Has the build otherwise succeed btw? Because I have seen similar errors (although I don’t speak French and from your screenshot I cannot copy-paste, so cannot say if the message itself is the same or not) in otherwise successful builds that then allowed running and debugging Slicer without problems.

---

<div class="post-metadata">

### Author: ![Shoshoda](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Shoshoda](https://discourse.slicer.org/u/Shoshoda)
#### Post date: [May 10, 2022, 12:45pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/6 "2022-05-10T12:45:20Z")

</div>

> [@cpinter](#):
>
> Has the build otherwise succeed btw? Because I have seen similar errors (although I don’t speak French and from your screenshot I cannot copy-paste, so cannot say if the message itself is the same or not) in otherwise successful builds that then allowed running and debugging Slicer without problems.

Yes sorry I didn’t notice that my screenshot was in french. There is copy-paste of the screenshot :

|Erreur|MSB8066|la build personnalisée de ‘C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-configure.rule;C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-build.rule;C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-forceconfigure.rule;C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-install.rule;C:\D\S4R\CMakeFiles\d0fbb327fb5d8976f542b004b1325aa2\Slicer-complete.rule;C:\D\S4R\CMakeFiles\dbe9d635f197b17f63b9c895eaab2164\Slicer.rule’ s’est arrêtée. Code 1.|Slicer|C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets|245||

* * *

And here are the logs I get :

Performing configure step for ‘Slicer’  
loading initial cache file C:/D/S4R/Slicer-prefix/tmp/Slicer-cache-Release.cmake  
– Setting C++ standard  
– Setting C++ standard - C++14  
– Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19043.

Slicer should not be configured & built in the Slicer source directory  
You must run cmake in a build directory.  
For example:  
mkdir Slicer-sandbox ; cd Slicer-sandbox  
git clone [GitHub - Slicer/Slicer: Multi-platform, free open source software for visualization and image computing.](https://github.com/Slicer/Slicer.git) # or download & unpack the source tarball  
mkdir Slicer-SuperBuild  
this will create the following directory structure

Slicer-sandbox  
±-Slicer  
±-Slicer-SuperBuild

Then you can proceed to configure and build  
by using the following commands

cd Slicer-SuperBuild  
cmake …/Slicer # or ccmake, or cmake-gui  
make

NOTE: Given that you already tried to make an in-source build  
CMake have already created several files & directories  
in your source tree. run ‘git status’ to find them and  
remove them by doing:

```
    cd Slicer-sandbox/Slicer
    git clean -n -d
    git clean -f -d
    git checkout --

```

CMake Error at CMake/PreventInSourceBuilds.cmake:42 (message):  
Quitting configuration  
Call Stack (most recent call first):  
CMake/PreventInSourceBuilds.cmake:46 (AssureOutOfSourceBuilds)  
CMakeLists.txt:93 (include)

– Configuring incomplete, errors occurred!  
See also “C:/D/S4/CMakeFiles/CMakeOutput.log”.  
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): error MSB8066: la build personnalisée de ‘C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-configure.rule;C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-build.rule;C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-forceconfigure.rule;C:\D\S4R\CMakeFiles\26b24c13142eddf123c97e3494499225\Slicer-install.rule;C:\D\S4R\CMakeFiles\d0fbb327fb5d8976f542b004b1325aa2\Slicer-complete.rule;C:\D\S4R\CMakeFiles\dbe9d635f197b17f63b9c895eaab2164\Slicer.rule’ s’est arrêtée. Code 1.

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [May 10, 2022, 3:45pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/7 "2022-05-10T15:45:33Z")

</div>

> [@Shoshoda](#):
>
> Slicer should not be configured & built in the Slicer source directory

This looks like a good next point of attention.

---

<div class="post-metadata">

### Author: ![Shoshoda](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Shoshoda](https://discourse.slicer.org/u/Shoshoda)
#### Post date: [May 11, 2022, 3:31pm UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/8 "2022-05-11T15:31:38Z")

</div>

So it’s now working !  
I was working on two different folder like the doc say : C:\D\S4 and C:\D\S4R  
but It’s wasn’t working.  
So I tried C:\D\S4\Slicer with the sources code and it’s finaly working fine.

Thanks for your help

Michael

---

<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: [May 12, 2022, 3:43am UTC](https://discourse.slicer.org/t/error-during-generation-with-visual-studio/23345/9 "2022-05-12T03:43:02Z")

</div>

> [@Shoshoda](#):
>
> C:\D\S4 and C:\D\S4R  
> but It’s wasn’t working.  
> So I tried C:\D\S4\Slicer with the sources code and it’s finaly working fine.

It is great to hear this!

It seems that the problem was that you checked out the source code into `C:\D\S4\Slicer` instead of `C:\D\S4`. This most likely happened because you have forgot the `.` from the command that was described in the [build instructions](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/windows.html#set-up-source-and-build-folders): `git clone https://github.com/Slicer/Slicer.git .` (if you don’t have the `.` in the end then a `Slicer` subfolder is created).
