Compilation errors

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

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?

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

VS2017 may be too old for building ITK.

1 Like

Visual Studio 2017 is not tested anymore as mentioned in Windows — 3D Slicer documentation. 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?

2 Likes

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.

1 Like

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.

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

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.

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.

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

Okay, I understand. Thank you for your help :grinning: