# Registration with ITK not working - Unexplainable Erros

**URL:** https://discourse.itk.org/t/registration-with-itk-not-working-unexplainable-erros/6021
**Category:** Beginner Questions
**Tags:** itk, cmake, registration
**Created:** [June 26, 2023, 4:46pm UTC](https://discourse.itk.org/t/registration-with-itk-not-working-unexplainable-erros/6021 "2023-06-26T16:46:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JRopers](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/77aa72/32.png) [@JRopers](https://discourse.itk.org/u/JRopers)
#### Post date: [June 26, 2023, 4:46pm UTC](https://discourse.itk.org/t/registration-with-itk-not-working-unexplainable-erros/6021/1 "2023-06-26T16:46:26Z")

</div>

Hello everyone!

I have come here as a last resort as I am really struggling to get ITK to run. First of all, some information on my system:

OS: Windows 11  
Visual Studio: 2017  
Architecture: x64  
C++ Standard: v141

Now to my problem: I have downloaded the ITK 5.3.0 source code. I have configured this using cmake-gui, as explained in the docs, setting the correct Visual Studio and architecture and even including modules that seemed related to registration. I configured everything until all red highlights are gone and then generated the build files.  
Next, I opened the generated VS solution, made sure that everything is set to the correct C++ standard and x64 architecture, and then I built the ALL\_BUILD. This completed successfully. Next, I built the INSTALL in the same way, which also finished successfully with no errors.  
Finally, I started my own project and made sure to link and add all library and include directories in the VS Project Properties. Again, I made usre everything was set to the same C++ standard and x64 architecture. First, I tried building the HelloWorld program and this also worked.  
Now I am getting to the problem: I wanted to start writing some code to work on a simple rigid registration problem and included the following libraries:

```cpp
*#include <iostream>*
*#include <itkImage.h>*
*#include <itkImageFileReader.h>*
*#include <itkImageFileWriter.h>*
*#include <itkCenteredTransformInitializer.h>*
*#include <itkVersorRigid3DTransform.h>*
*#include <itkImageRegistrationMethod.h>*
*#include <itkMeanSquaresImageToImageMetric.h>*
*#include <itkRegularStepGradientDescentOptimizer.h>*

```

Originally I even had some of them withe v4 suffix which I removed. Now I am getting a series of errors. Some examples are listed below:

```plaintext
|Error (active)|E2512|the argument to a feature-test macro must be a simple identifier|bioconstraintregistration|C:\Program Files\ITK\include\ITK-5.3\itksys\Configure.hxx|37||

|Error|C2244|'itk::MatrixOffsetTransformBase<TParametersValueType,VInputDimension,VOutputDimension>::TransformDiffusionTensor3D': unable to match function definition to an existing declaration|bioconstraintregistration|c:\program files\itk\include\itk-5.3\itkmatrixoffsettransformbase.hxx|257||

|Error|C2244|'itk::AffineTransform<TParametersValueType,VDimension>::Metric': unable to match function definition to an existing declaration|bioconstraintregistration|c:\program files\itk\include\itk-5.3\itkaffinetransform.hxx|294||

|Error|C2244|'itk::BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>::EvaluateAtContinuousIndexInternal': unable to match function definition to an existing declaration|bioconstraintregistration|c:\program files\itk\include\itk-5.3\itkbsplineinterpolateimagefunction.hxx|460||

```

There are a few errors related to each class but at this point I have tried reinstalling, rebuilding with various modules, etc. and cannot remove these errors.

Can anyone help me out with this? Did I install ITK incorrectly? Am I including incorrect headers?

Thank you so much for the help ahead!

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [June 26, 2023, 6:53pm UTC](https://discourse.itk.org/t/registration-with-itk-not-working-unexplainable-erros/6021/2 "2023-06-26T18:53:04Z")

</div>

If you are not using CMake as your project’s build system, take a look at [this discussion](https://discourse.itk.org/t/itk-include-directories-for-vs2017/589) and [old instructions](https://itk.org/Wiki/ITK/Using_ITK_Without_CMake).

---

<div class="post-metadata">

### Author: ![JRopers](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/77aa72/32.png) [@JRopers](https://discourse.itk.org/u/JRopers)
#### Post date: [June 27, 2023, 8:40am UTC](https://discourse.itk.org/t/registration-with-itk-not-working-unexplainable-erros/6021/3 "2023-06-27T08:40:38Z")

</div>

Thank you so much! I did not realize that building it with Visual Studio was the problem. I am now just regularly building with CMake and it works! Thank you so much for your quick response!
