[vtkusers] inheriting from a VTK class

Mike Jackson imikejackson at gmail.com
Fri Jul 28 09:30:29 EDT 2006


Try inserting this into your implementation file:

vtkStandardNewMacro(MyViewer);

Mike Jackson


On Jul 28, 2006, at 6:30 AM, Pankaj Daga wrote:

> Hi folks,
>
> I have run into trouble trying to derive from a VTK class. I am  
> trying to override the render function of the vtkImageViewer2. Here  
> is my code. Should be pretty simple, but for some reason when I try  
> to use it, it comes up with a linker error...saying undefined  
> reference to MyViewer::New()
>
> Here is my code:
>
> // Header file:
>
> #include "vtkImageViewer2.h"
>
> class MyViewer : public vtkImageViewer2
> {
>     public:
>         static MyViewer *New();
>         vtkTypeRevisionMacro(MyViewer,vtkImageViewer2);
>         void PrintSelf(ostream& os, vtkIndent indent);
>
>
>     virtual void Render(void)
>     {}
>
>     protected:
>         MyViewer()
>             :vtkImageViewer2()
>         {}
>
>         ~MyViewer()
>         {}
>     };
>
>
> // Implementation file
> vtkCxxRevisionMacro(MyViewer, "$Revision: 1.0 $");
> vtkStandardNewMacro(MyViewer);
>
> //-------------------------------------------------------------------- 
> --------
>
> void MyViewer::PrintSelf(ostream& os, vtkIndent indent)
> {
>     vtkImageViewer2::PrintSelf();
>
> }
>
>
> Any help would be appreciated.
>
> Thanks,
> Luca
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/ 
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

--------
Mike Jackson
imikejackson <at> gmail <dot> com






More information about the vtkusers mailing list