3

I have the following code:

#include <vtkInteractorStyleTrackballCamera.h>

class InteractorStyle : public vtkInteractorStyleTrackballCamera
{
    public:
        static InteractorStyle* New() {};
        vtkTypeMacro(InteractorStyle, vtkInteractorStyleTrackballCamera);
        InteractorStyle() {
            cout << "test";
        }
        virtual void OnLeftButtonDown();

        virtual void OnKeyPress();

    private:

};
vtkStandardNewMacro(InteractorStyle); //error here

void InteractorStyle::OnLeftButtonDown()
{
    std::cout << "test";
    // Forward events
    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
};
void InteractorStyle::OnKeyPress()
{
    // Get the keypress
    vtkRenderWindowInteractor *rwi = this->Interactor;
    std::string key = rwi->GetKeySym();

    // Output the key that was pressed
    std::cout << "Pressed " << key << std::endl;
    // Forward events
    vtkInteractorStyleTrackballCamera::OnKeyPress();
};

Even though I follow the tutorial, it always gives me below error for vtkStandardNewMacro(InteractorStyle); :

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

How to fix this?

2
  • this error might mean you are missing some headers.
    – AMA
    Commented Feb 27, 2017 at 11:05
  • 2
    @AMA Thanks.. I have to add #include <vtkObjectFactory.h>
    – Bla...
    Commented Feb 27, 2017 at 11:08

1 Answer 1

7

All you need to add is #include <vtkObjectFactory.h>. The tutorial never explicitly mentioned this, too bad.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.