Compile SimpleITK

Hello,

We are currently working on creating a new simpleitk.org website, unfortunately the old one is a little out of date.

The best documentation on how to get started building SimpleITK is here: https://simpleitk.readthedocs.io/en/master/building.html#

The compilation errors you are receiving is because you are compiled a version of SimpleITK that worked with ITKv4 and does not support the changes in ITKv5. Those changes are currently in the SimpleITK master branch, and the next release will support the stabalized ITK 5.1.

In the linked instructions, it strongly suggests using SimpleITK’s Superbuild, which automatically builds the proper version of ITK ( and other requirements ).

HTH.

2 Likes

Thank you Bradley. I have tried the following part of documentation:

1. Download the latest development version using git

git clone https://itk.org/SimpleITK.git

From where can I download a safe SimpleITK library ? Safe for compiling, of course :slight_smile:

Please use:

git clone https://github.com/SimpleITK/SimpleITK.git
1 Like

I have used that link, but the errors persist:

6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2039: 'TransformCategoryEnum': is not a member of 'itk::TransformBaseTemplate<double>' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  d:\project\simpleitk\code\common\include\sitkTransform.h(38): note: see declaration of 'itk::TransformBaseTemplate<double>'
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2146: syntax error: missing ';' before identifier 'TransformCategoryEnum' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): warning C4091: '': ignored on left of 'int' when no variable is declared [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2825: 'TransformCategoryEnum': must be a class or namespace when followed by '::' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2510: 'TransformCategoryEnum': left of '::' must be a class/struct/union [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2065: 'Linear': undeclared identifier [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  sitkSimilarity2DTransform.cxx
6>  Generating Code...
6>Done building project "SimpleITK.vcxproj" -- FAILED.
12>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
12>Project not selected to build for this solution configuration 
========== Build: 5 succeeded, 1 failed, 2 up-to-date, 6 skipped ==========

I was thinking that will be perfect if there will be available SimpleITK libraries already compiled, just like in Python case, or C# … it is frustrating to spent days to compile SimpleITK library (debug version by now) … and not succeeded …

Are you configuring SimpleITK? Are you using the SimpleITK’s Superbuild? Are you using you own compiled version of ITK?

Yes, I have compiled SimpleITK in CMake GUI:


And I have compiled through SuperBuild:

And no, I didn’t used my own ITK, as far as I know, the SuperBuild had bring it for me …

I can give you any extra-information that you need it for figure out what happen here.

Windows 10 64 bit, VS2017, VC++. CMake 3.16.3 … SimpleITK from https://github.com/SimpleITK/SimpleITK.git

I have run CMake inside of D:/Project/SimpleITK/SuperBuild.

Thank you for that additional information.

In your previous threads, it appears you had gotten SimpleITK to compile. What changed?

Because I have compiled the previous time as MD, not MT, and for my real project I need MT, I erased all, and I have compiled again. With this outcome. I have used the same settings.

E.g. /MDd /Zi /Ob0 /Od /RTC1 to /MTd /Zi /Ob0 /Od /RTC1 on CMake CMAKE_CXX_FLAGS_DEBUG

As I said, I erase all and do it again … that is all. And after I delete it all, I’ve taken the code from official site. Not worked … and seem that github version is not working anymore …

After all, I guess is not a problem if I start the compiling process from the beginning … I presume the whole process should run smoothly …

All libraries must be compiled with /MTd for the final project to be able to be compiled with /MTd. I am not sure whether super-builds propagate CMAKE_CXX_FLAGS to internal projects (I think they don’t).

In the SimpleITK Subperbuild all these flags are propagated to the external project:

So setting CMAKE_CXX_FLAGS should work as expected.

I have tried to compile as /MDd /Zi /Ob0 /Od /RTC1 and I got the same errors …

Steps:

git clone https://github.com/SimpleITK/SimpleITK.git

then I configure with CMake GUI ( this time I used /MTd /Zi /Ob0 /Od /RTC1 )

Then, after I compiled with VS2017, I got errors from above … I really don’t know what should I do … I have done something wrong ?

Hello,

I was able to successfully build SimpleITK on a windows WM following your instructions using CMake 3.14.1 and an updated Visual Studio 2017 professional.

In the configuration log I see you are using Visual Studio 2017 Community edition. I am wondering if that compiler is old and has a bug causing your compilation error. There is a newer Visual Studio Community 2019.

Other than that my only thought is that you some how have a dirty directory around in your build environment that you some how are using by mistake.

In documentation doesn’t write that should use Visual Studio Professional Edition … as far as I know.

Can you show me what configuration of your functional Visual Studio ?

Anyway, after errors, I doubt that could be the compiler the problem:

6>  sitkImage.cxx
6>  sitkTransform.cxx
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2039: 'TransformCategoryEnum': is not a member of 'itk::TransformBaseTemplate<double>' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  D:\Project\SimpleITK\Code\Common\include\sitkTransform.h(38): note: see declaration of 'itk::TransformBaseTemplate<double>'
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2146: syntax error: missing ';' before identifier 'TransformCategoryEnum' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): warning C4091: '': ignored on left of 'int' when no variable is declared [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2825: 'TransformCategoryEnum': must be a class or namespace when followed by '::' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2510: 'TransformCategoryEnum': left of '::' must be a class/struct/union [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2065: 'Linear': undeclared identifier [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  sitkAffineTransform.cxx
6>  sitkBSplineTransform.cxx
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2039: 'TransformCategoryEnum': is not a member of 'itk::TransformBaseTemplate<double>' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  d:\project\simpleitk\code\common\include\sitkTransform.h(38): note: see declaration of 'itk::TransformBaseTemplate<double>'
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2146: syntax error: missing ';' before identifier 'TransformCategoryEnum' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): warning C4091: '': ignored on left of 'int' when no variable is declared [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2825: 'TransformCategoryEnum': must be a class or namespace when followed by '::' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2510: 'TransformCategoryEnum': left of '::' must be a class/struct/union [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2065: 'Linear': undeclared identifier [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  sitkDisplacementFieldTransform.cxx
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2039: 'TransformCategoryEnum': is not a member of 'itk::TransformBaseTemplate<double>' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  d:\project\simpleitk\code\common\include\sitkTransform.h(38): note: see declaration of 'itk::TransformBaseTemplate<double>'
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2146: syntax error: missing ';' before identifier 'TransformCategoryEnum' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): warning C4091: '': ignored on left of 'int' when no variable is declared [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2825: 'TransformCategoryEnum': must be a class or namespace when followed by '::' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2510: 'TransformCategoryEnum': left of '::' must be a class/struct/union [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2065: 'Linear': undeclared identifier [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  sitkEuler2DTransform.cxx
6>  sitkScaleVersor3DTransform.cxx
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2039: 'TransformCategoryEnum': is not a member of 'itk::TransformBaseTemplate<double>' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>  d:\project\simpleitk\code\common\include\sitkTransform.h(38): note: see declaration of 'itk::TransformBaseTemplate<double>'
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): error C2146: syntax error: missing ';' before identifier 'TransformCategoryEnum' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(150): warning C4091: '': ignored on left of 'int' when no variable is declared [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2825: 'TransformCategoryEnum': must be a class or namespace when followed by '::' [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2510: 'TransformCategoryEnum': left of '::' must be a class/struct/union [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]
6>d:\project\simpleitk\code\common\src\sitkPimpleTransform.hxx(151): error C2065: 'Linear': undeclared identifier [D:\Project\SimpleITK\SuperBuild\bin\SimpleITK-build\Code\Common\src\SimpleITKCommon.vcxproj]

I updated VS2017 at the SDK 10.0.17134.0, and had compiled.