gpt4 book ai didi

c++ - vtkStandardNewMacro 给出错误 C4430 : missing type specifier

转载 作者:搜寻专家 更新时间:2023-10-31 00:09:33 30 4
gpt4 key购买 nike

我有以下代码:

#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);,它总是给我以下错误:

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

如何解决这个问题?

最佳答案

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

关于c++ - vtkStandardNewMacro 给出错误 C4430 : missing type specifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42484095/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com