Error when building the latest build (2020-03-25)

I just tried building the latest code and got several errors. My building environment includes VS 2017, windows 10. After some searching, I found these errors are all related to itkv5 compatibility as listed below.

Error C2039 ‘SetNumberOfThreads’: is not a member of ‘itk::MultiThreaderBase’ ExpertAutomatedRegistrationLib …\slicersources-src\modules\cli\expertautomatedregistration\itkregistrationhelper\itkImageToImageRegistrationMethod.txx 39

In the ITK migration guide, it is recommended to change ‘SetNumberOfThreads’ to ‘SetNumberOfWorkUnits’.

And the following errors maybe related to the ITK_LEGACY_REMOVE flag which is still off in External_ITK.cmake.

Error C3668 ‘itk::InverseDisplacementFieldTransform<double,3>::ComputeJacobianWithRespectToPosition’: method with override specifier ‘override’ did not override any base class methods MRMLCore (Core-Libs\MRMLCore\MRMLCore) …\slicersources-src\libs\mrml\core\vtkITKTransformInverse.h 198
Error C3668 ‘itk::InverseDisplacementFieldTransform<double,3>::ComputeInverseJacobianWithRespectToPosition’: method with override specifier ‘override’ did not override any base class methods MRMLCore (Core-Libs\MRMLCore\MRMLCore) …\slicersources-src\libs\mrml\core\vtkITKTransformInverse.h 216
Error C3668 ‘itk::InverseThinPlateSplineKernelTransform<double,3>::ComputeJacobianWithRespectToPosition’: method with override specifier ‘override’ did not override any base class methods MRMLCore (Core-Libs\MRMLCore\MRMLCore) …\slicersources-src\libs\mrml\core\vtkITKTransformInverse.h 283
Error C2440 ‘initializing’: cannot convert from ‘const std::list<itk::SmartPointer<itk::TransformBaseTemplate>,std::allocator<_Ty>> *’ to ‘TransformListType *’ MRMLCore (Core-Libs\MRMLCore\MRMLCore) …\slicersources-src\Libs\MRML\Core\vtkMRMLTransformStorageNode.cxx 166
Error C2039 ‘TerminateThread’: is not a member of ‘itk::PlatformMultiThreader’ SlicerBaseLogic …\slicersources-src\Base\Logic\vtkSlicerApplicationLogic.cxx 93
Error C2039 ‘SpawnThread’: is not a member of ‘itk::PlatformMultiThreader’ SlicerBaseLogic …\slicersources-src\Base\Logic\vtkSlicerApplicationLogic.cxx 187

Any suggestions or workaround?

Do you build Slicer according to the build instructions or do you have a special configuration (such as trying to build Slicer with an externally built ITK)?

Yes, I followed the build instructions. When building the nightly version around December 2019, everything was OK. I notice that the superbuild’s ITK has been updated from pre-v5.1b01 to v5.1rc01 in January and it seems to be the reason.

If you built Slicer months ago then you need to rebuild it from scratch (delete the entire Slicer build folder, which contains ITK, VTK, … build trees).

Thanks, I’ll try again.

After cleaning the build directory and rebuild the whole project, now it works.

1 Like