# Compilation errors

**URL:** <https://discourse.slicer.org/t/compilation-errors/31552>\
**Category:** Development\
**Tags:** build\
**Created:** [September 4, 2023, 3:46pm UTC](https://discourse.slicer.org/t/compilation-errors/31552 "2023-09-04T15:46:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwangwangwang](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@iwangwangwang](https://discourse.slicer.org/u/iwangwangwang)\
**Post date:** [September 4, 2023, 3:46pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/1 "2023-09-04T15:46:43Z")

</div>

After going through countless hardships, I have finally solved most of the compilation problems, but there are still some problems that are difficult for me. I would like to ask how to solve these problems?

1. in ITK project  
itkAffineTransform.hxx(294): error C2244: “slicer\_itk::AffineTransform\<TParametersValueType,VDimension\>::Metric”: Cannot match function definition with existing declaration  
… a lot of C2244 error

2. in ITK project  
itkInterpolateImageFunction.h(79): error C2653: “InputImageType”: Not a class or namespace name  
…a lot of C2653 error

3. in ITK project  
itkCenteredSimilarity2DTransform.h(99): error C2146: Syntax error: Missing ‘;’  
…a lot of C2146 error

4. in ITK project  
itkCenteredSimilarity2DTransform.h(99): error C4430: Missing type descriptor - assumed to be int. Note: C++does not support default ints

there were many errors  
sincerely for help

---

<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:** [September 4, 2023, 4:08pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/2 "2023-09-04T16:08:24Z")

</div>

Can you provide information on the following?

- What OS version are you using? e.g. Windows 11 Pro 22H2

- What version of the application are you using to compile Slicer? e.g. Visual Studio 2022 17.7.3 Community edition

- What version of CMake are you using? e.g. CMake 3.27.4

- What version of Slicer are you trying to build? Latest `main` or a git tag like `v5.4.0`?

Any other non-standard build options that you are using?

---

<div class="post-metadata">

**Author:** ![iwangwangwang](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@iwangwangwang](https://discourse.slicer.org/u/iwangwangwang)\
**Post date:** [September 5, 2023, 12:54am UTC](https://discourse.slicer.org/t/compilation-errors/31552/4 "2023-09-05T00:54:24Z")

</div>

Here are some information you mentioned：  
OS: windows11 professional 22H2  
compiler: visual studio 2017 enterprise edition 15.9.56  
CMake: 3.26.0  
Slicer: latest main unknown version  
Qt: 5.15.2  
git: 2.42.0 windows.2  
python: 3.9  
A key point： set \_LINKER\_FLAGS\_DEBUG /INCREMENT:NO

Hope the above information can help you understand my problem

---

<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:** [September 5, 2023, 4:47pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/5 "2023-09-05T16:47:53Z")

</div>

> [@iwangwangwang](#):
>
> visual studio 2017 enterprise edition 15.9.56

VS2017 may be too old for building ITK.

---

<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:** [September 5, 2023, 4:54pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/6 "2023-09-05T16:54:07Z")

</div>

Visual Studio 2017 is not tested anymore as mentioned in [Windows — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/windows.html#install-prerequisites). Maybe something has changed in the dependency tree and we will need to update that note in the build instructions. The Slicer ITK version says that Visual Studio 15.7 with the v141 toolset or later should work as it conformed to the C++11/14/17 standard.

Would you be able to download and install Visual Studio 2022 and use its default v143 toolset instead?

---

<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:** [September 5, 2023, 4:57pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/7 "2023-09-05T16:57:34Z")

</div>

Also note that ITK has removed support for Visual Studio 2017 in `v5.4rc01`. Slicer updates the ITK version that it uses every so often, so Visual Studio 2017 will likely be dropped in Slicer soon as well.

> <https://github.com/InsightSoftwareConsortium/ITK/commit/140f3c249fbb20c4f4a1607e563e19ee9a9cbd78>
>
> Enabling C++17 broke VS2017 due to its numerous bugs. See discussion:
> https://di…scourse.itk.org/t/c-17-breaks-visual-studio-2017-drop-support/5884

---

<div class="post-metadata">

**Author:** ![iwangwangwang](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@iwangwangwang](https://discourse.slicer.org/u/iwangwangwang)\
**Post date:** [September 5, 2023, 6:33pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/8 "2023-09-05T18:33:56Z")

</div>

Roger that, by the way，Slicer 5.4 or lower version has the same requirements?  
maybe I want to compile a lower version which is more convenience.

---

<div class="post-metadata">

**Author:** ![iwangwangwang](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@iwangwangwang](https://discourse.slicer.org/u/iwangwangwang)\
**Post date:** [September 5, 2023, 6:36pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/9 "2023-09-05T18:36:39Z")

</div>

Is the version of ITK associated with the version of Slicer？ what about compiling a lower version of Slicer with VS2017

---

<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:** [September 5, 2023, 6:46pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/10 "2023-09-05T18:46:35Z")

</div>

We suggest you try to stick as close to the latest releases of everything as possible and not rely on older versions or compilers or you are likely to get stuck and not get any new fixes or features. Of course we don’t break things on purpose but often there are good reasons why people drop support for old compilers.

---

<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:** [September 5, 2023, 6:47pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/11 "2023-09-05T18:47:51Z")

</div>

Yes the ITK version is associated with the Slicer version. Slicer has required C++17 starting with Slicer 5.2.0 so you would have to go all the way back to the Slicer 5.0.x series of code to likely compile successfully using Visual Studio 2017. I would highly discourage this if you’re able to download and install Visual Studio 2022.

Slicer 5.0.x was released 1.5 years ago and you won’t get all the improvements and bug fixes since then unless you spend time trying to backport small changes. Since Slicer developers have limited resources generally we can only support efforts for the latest Slicer Stable (currently 5.4.0) or the latest Slicer preview.

---

<div class="post-metadata">

**Author:** ![iwangwangwang](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@iwangwangwang](https://discourse.slicer.org/u/iwangwangwang)\
**Post date:** [September 5, 2023, 7:01pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/12 "2023-09-05T19:01:54Z")

</div>

Okay, I will follow your suggestions, thanks^-^

---

<div class="post-metadata">

**Author:** ![iwangwangwang](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@iwangwangwang](https://discourse.slicer.org/u/iwangwangwang)\
**Post date:** [September 5, 2023, 7:03pm UTC](https://discourse.slicer.org/t/compilation-errors/31552/13 "2023-09-05T19:03:27Z")

</div>

Okay, I understand. Thank you for your help 😀
