Hello,
I have a question about defining return types in the header file. I'm using the ITK toolkit and define a return type in my header, but when I compile the code the compiler returns an error that I have not defined the type. My code looks something like below and when I compile it I get the error Registrations.cpp:3: error: ‘VectrImageType’ has not been declared . If I re-type the typedefs in the cpp file it compiles fine, but I thought that the header file would create the types and pass them to the cpp file when I #include it. Why do I need to retype the typedefs?
I have taught myself c++ over the last few months coming from a matlab background, so general comments are also welcome...
#include "Registrations.h"
VectrImageType::PixelType Registrations::GlobalRegistration( FixedImageType::Pointer fImage, MovingImageType::Pointer mImage, unsignedint numberOfThreads)
{
/* A whole bunch of code to do my bidding*/
}
VectrImageType::PixelType Registrations::DVCRegistrationLinear( FixedImageType::Pointer fImage, MovingImageType::Pointer mImage, VectrPixelType initializationData,unsignedint numberOfThreads)
{
/* More code to make the computer my slave*/
}
You didn't define VectrImageType in the global namespace.
This should work:
1 2 3 4 5 6 7 8 9 10
#include "Registrations.h"
Registrations::VectrImageType::PixelType Registrations::GlobalRegistration( FixedImageType::Pointer fImage, MovingImageType::Pointer mImage, unsignedint numberOfThreads)
{
/* A whole bunch of code to do my bidding*/
}
Registrations::VectrImageType::PixelType Registrations::DVCRegistrationLinear( FixedImageType::Pointer fImage, MovingImageType::Pointer mImage, VectrPixelType initializationData,unsignedint numberOfThreads)
{
/* More code to make the computer my slave*/
}