[vtkusers] VTK custom subclass: basic implementation

Marcos fotosentido at gmail.com
Wed Sep 2 13:15:19 EDT 2015


I created an vtkinteractor subclass. This is the header:

#include "vtkInteractionStyleModule.h" // For export macro

#include "vtkInteractorStyleImage.h"

class DcmInteractorStyle : public vtkInteractorStyleImage



  static DcmInteractorStyle* New();

  vtkTypeRevisionMacro(DcmInteractorStyle, vtkInteractorStyleImage)

  virtual void OnLeftButtonDown();


I just want to override mouse events.
I'm following the example:

It doesn't show .cpp contents, so I went inside mine with:


void DcmInteractorStyle::OnLeftButtonDown()


    // here my code


But the compiler (with CMakeLists.txt) says:
ui_qt.lib(viewerwidget.cpp.obj):-1: error: LNK2019: unresolved external
symbol "public: static class DcmInteractorStyle * __cdecl
DcmInteractorStyle::New(void)" (?New at DcmInteractorStyle@@SAPAV1 at XZ)
referenced in function "public: static class vtkSmartPointer<class
DcmInteractorStyle> __cdecl vtkSmartPointer<class
DcmInteractorStyle>::New(void)" (?New@?$vtkSmartPointer at VDcmInteractorStyle
@@@@SA?AV1 at XZ)

At CMake mail list someone told me it was because I don't have the New()
method defined (what about the macro then?).

My constructor won't do anything different, just the same as the superclass.
I tried:

DcmInteractorStyle* DcmInteractorStyle::New() : vtkInteractorStyleImage::New()



It gives me:

error: C2550: 'DcmInteractorStyle::New' : constructor initializer
lists are only allowed on constructor definitions

Any help, please?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150902/80518d56/attachment.html>

More information about the vtkusers mailing list