[vtkusers] vtkTypeRevisionMacro & New( )
Brad King
brad.king at kitware.com
Thu Oct 21 09:27:02 EDT 2004
Michael Thomas wrote:
> Hi Guys,
>
> I am trying to use the latest vtkDICOMImageReader class but when I compile the app, I get linker errors related to vtkTypeRevisionMacro & New( )functions in the vtkDICOMImageReader.h file.
>
> == CUT ==
>
> class CTestDicomImage : public vtkImageReader2
> {
> public:
> static CTLADicomImage *New();
> vtkTypeRevisionMacro( CTLADicomImage, vtkImageReader2);
> .....
> .....
> .....
> }
>
> == CUT ==
>
> The linker errors I get are these...
>
> TLADicomImage.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall CTestDicomImage::CollectRevisions(class ostream &)" (?CollectRevisions at CTestDicomImage@@MAEXAAVostream@@@Z)
> TLADicomImage.obj : error LNK2001: unresolved external symbol "public: static class CTestDicomImage * __cdecl CTestDicomImage::New(void)" (?New at CTestDicomImage@@SAPAV1 at XZ)
>
> As you guys would have noticed, I am not using the vtkDICOMImageReader class as is... Using them as is gives me several linker errors. So I created a dummy C++ class on VC++ 6.0 & used the content of vtkDICOMImageReader & replaced all vtkDICOMImageReader occurances with my Test class name i.e. CTestDicomImage. I had to remove the references to the vtkstd in the vtkDICOMImageReaderVector class as its a recent implementation while I am still using VTK 4.0( I suppose I will replace them with some other MFC list or collections). Everything seems fine except for these 2 linker errors. Whats going wrong here???
>
> Could someone give some helpful pointers. What is the revision macro used for??? Why is there no implementation of *New() in most .cxx files. Am I missing something???
You left these two lines out of the .cxx file in your modified version:
vtkCxxRevisionMacro(vtkDICOMImageReader, "$Revision: 1.1 $");
vtkStandardNewMacro(vtkDICOMImageReader);
These macros expand into definitions of the symbols you are missing.
-Brad
More information about the vtkusers
mailing list