1

我是 vtk 的新手,我想使用 vtkCharts 库。在 Linux 和 Windows 中,我编译了 vtk 并设法使用了大多数示例。

唯一麻烦的例子是那些包括图表库的例子,比如链接中的那个:

线图示例

当我编译时,在 Visual Studio 中它会给出一些链接错误。下面有一段。我没有忘记包含 vtkCharts 库。

1>vtkCharts.lib(vtkContextView.obj):错误 LNK2019:未解析的外部符号“受保护:虚拟 __thiscall vtkRenderView::~vtkRenderView(void)”(??1vtkRenderView@@MAE@XZ) 在函数“受保护:虚拟 __thiscall vtkContextView”中引用::~vtkContextView(void)" (??1vtkContextView@@MAE@XZ) 1>vtkCharts.lib(vtkContextView.obj) : error LNK2019: unresolved external symbol "public: virtual void __thiscall vtkRenderView::SetDisplayHoverText(bool)" ( ?SetDisplayHoverText@vtkRenderView@@UAEX_N@Z) 在函数“受保护:__thiscall vtkContextView::vtkContextView(void)”(??0vtkContextView@@IAE@XZ) 1>vtkCharts.lib(vtkContextView.obj) 中引用:错误 LNK2019:未解决外部符号“受保护:__thiscall vtkRenderView::vtkRenderView(void)”(??0vtkRenderView@@IAE@XZ) 函数“受保护:__thiscall vtkContextView::vtkContextView(void)”(??0vtkContextView@@IAE@XZ) 1>vtkCharts.lib(vtkContextView.obj) 中引用:错误 LNK2001:未解决外部符号“public:virtual void __thiscall vtkView::Update(void)”(?Update@vtkView@@UAEXXZ) 1>vtkCharts.lib(vtkContextView.obj):错误 LNK2001:未解析的外部符号“public:virtual void __thiscall vtkRenderView: :ApplyViewTheme(class vtkViewTheme *)" (?ApplyViewTheme@vtkRenderView@@UAEXPAVvtkViewTheme@@@Z) 1>vtkCharts.lib(vtkContextView.obj) : error LNK2001: unresolved external symbol "protected: virtual void __thiscall vtkRenderView::ProcessEvents(class vtkObject *,unsigned long,void *)" (?ProcessEvents@vtkRenderView@@MAEXPAVvtkObject@@KPAX@Z)(?ProcessEvents@vtkRenderView@@MAEXPAVvtkObject@@KPAX@Z)

在 Code::Blocks 中,使用 GCC,它会给出如下错误:

./VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|38|错误:“{”标记前的预期类名| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|错误:'vtkContextItem'没有命名类型| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|错误:'vtkContextItem'尚未声明| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|错误:从类型“vtkObjectBase*”到类型“vtkChart*”的静态转换无效| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在成员函数'virtual vtkObjectBase* vtkChart::NewInstanceInternal() const':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|错误:'新'不是'vtkChart'的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在成员函数'virtual vtkAnnotationLink* vtkChart::GetAnnotationLink()':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|错误:“类 vtkChart”没有名为“GetDebug”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在成员函数'virtual void vtkChart::SetGeometry(int, int)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误:“类 vtkChart”没有名为“GetDebug”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误:'class vtkChart'没有名为'Modified'的成员| .. /VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在成员函数'virtual int* vtkChart::GetGeometry()':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:'class vtkChart'没有名为'GetDebug'的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在成员函数'virtual void vtkChart::GetGeometry(int&, int&)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:'class vtkChart'没有名为'GetDebug'的成员| “类 vtkChart”没有名为“GetDebug”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在成员函数'virtual void vtkChart::GetGeometry(int&, int&)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:'class vtkChart'没有名为'GetDebug'的成员| “类 vtkChart”没有名为“GetDebug”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:“类 vtkChart”没有名为“GetClassName”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在成员函数'virtual void vtkChart::GetGeometry(int&, int&)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:'class vtkChart'没有名为'GetDebug'的成员| GetGeometry(int&, int&)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:'class vtkChart'没有名为'GetDebug'的成员| GetGeometry(int&, int&)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误:'class vtkChart'没有名为'GetDebug'的成员|

我在两个平台上都使用 vtk 5-6。我想知道为什么会出现这个错误。

谢谢你。

4

1 回答 1

1

我没有忘记包含 vtkCharts 库。

然后你可能忘了包含 vtkHybrid 库。注意 cmake 文件中的最后一行。

于 2011-06-19T13:44:11.990 回答