vtkStandardNewMacro gives error C4430: missing type specifier

只谈情不闲聊 提交于 2019-12-02 06:09:47

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/42484095/vtkstandardnewmacro-gives-error-c4430-missing-type-specifier

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!