1
我有以下代碼:vtkStandardNewMacro給出錯誤C4430:缺少類型說明
#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
如何解決這個問題?
此錯誤可能意味着您缺少一些標題。 – AMA
@AMA謝謝..我必須添加'#include' –