[Insight-users] DataObject inheritance problems

Aaron Cois cacst11+@pitt.edu
Fri, 21 Mar 2003 15:03:07 -0500


I am attempting to create an object which derives from DataObject. Right 
now the class has no real functionality to it, and the definition looks 
like:

template<typename TItemType>
class UnaryCorrespondenceMatrix : public DataObject{
public:
 /** Standard class typedefs. */
 typedef UnaryCorrespondenceMatrix Self;
 typedef DataObject Superclass;
 typedef SmartPointer<Self>   Pointer;
 typedef SmartPointer<const Self>  ConstPointer;

 /** Method for creation through the object factory */
 itkNewMacro(Self);

 /** Run-time type information (and related methods) */
 itkTypeMacro(itkUnaryCorrespondenceMatrix, DataObject);

 /** Default Constructor */
 UnaryCorrespondenceMatrix();

 /** Default Destructor */
 ~UnaryCorrespondenceMatrix() {};

protected:

 /** Virtual methods required by DataObject interface.   */
 void UpdateOutputInformation() {}
 bool VerifyRequestedRegion() { return true; }
 void SetRequestedRegionToLargestPossibleRegion () {}
 bool RequestedRegionIsOutsideOfTheBufferedRegion () { return false; }
 void SetRequestedRegion (DataObject *) {}

};


   As far as i can tell this is all correct (I also have another class 
similar to this one which works fine) but when i try to declare an 
object using:

typedef itk::UnaryCorrespondenceMatrix<double> CorrespondenceMatrixType;
typedef itk::UnaryCorrespondenceMatrix<double>::Pointer 
CorrespondenceMatrixPointer;

CorrespondenceMatrixPointer corr_matrix;
corr_matrix = CorrespondenceMatrixType::New();

   I get a linker error looking like:

ChimeraTest error LNK2001: unresolved external symbol "protected: 
virtual void __thiscall 
itk::UnaryCorrespondenceMatrix<double>::UpdateOutputInformation(void)" 
(?UpdateOutputInformation@?$UnaryCorrespondenceMatrix@N@itk@@MAEXXZ)


This is baffling me, since I have another class inheriting from 
DataObject which is almost identical and works perfectly.  I only get 
the linker error when I attempt to create the object using New() (if i 
comment it out the error disappears).  Any help or information would be 
sincerely appreciated.

   -Aaron