Override not work? (itk5)

Hi everyone!
I’m trying to run my code by ITK newest version 5. But I got this error. Can you help me fix it?

/home/itkReadParameters.h: In instantiation of ‘class itk::RegistrationParameters<3>’:
/home/DeformableRegistration.h:140:60:   required from ‘class itk::DeformableRegistration<short int, 3>’
/home/BSplineRegistration.cxx:251:72:   required from here
/opt/InsightToolkit-5.0.1/Modules/Core/Common/include/itkMacro.h:359:15: error: ‘const char* itk::RegistrationParameters<ImageDimension>::GetNameOfClass() const [with unsigned int ImageDimension = 3]’ marked ‘override’, but does not override
   const char *GetNameOfClass() const override \
               ^
/home/sbin/itkReadParameters.h:187:3: note: in expansion of macro ‘itkTypeMacro’
   itkTypeMacro(RegistrationParameters, None);

Thanks!

I don’t remember anything done to GetNameOfClass method in v4 to v5 transition. Perhaps you should look at the migration guide, especially section Legacy code removed.

1 Like

You might want to use itkTypeMacroNoParent instead of itkTypeMacro in itkReadParameters.h:187.

1 Like

Thank you. I tried with itkTypeMacroNoParent, but it still doesn’t work.

What is the declaration of your class itkReadParameters? And what is the new error? Does enabling/disabling legacy when compiling ITK matter in ITKv4? What about ITKv5?