vtkStandardNewMacro给出错误C4430:缺少类型说明符

时间:2017-02-27 11:01:39

标签: c++ vtk

我有以下代码:

#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();
};

即使我按照tutorial进行操作,它总是会让我误以为vtkStandardNewMacro(InteractorStyle);

  

错误C4430:缺少类型说明符 - 假设为int。注意:C ++没有   支持default-int

如何解决这个问题?

1 个答案:

答案 0 :(得分:6)

您需要添加的只是#include <vtkObjectFactory.h>。该教程从未明确提到这一点,太糟糕了。