vtkCharts库既不适用于Visual Studio,也不适用于GCC编译器 - 为什么?

vtkCharts library doesn't work neither with Visual Studio nor with GCC compiler - Why?

本文关键字:适用于 不适用 编译器 GCC 为什么 Studio Visual vtkCharts      更新时间:2023-10-16

我是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( : 错误 LNK2019:未解析的外部 符号"公共:虚拟虚空 __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:未解析的外部 符号"公共:虚拟虚空 __thiscall vtkView::Update(void(" (?Update@vtkView@@UAEXXZ( 1>vtkCharts.lib(vtkContextView.obj( : 错误 LNK2001:未解析的外部 符号"公共:虚拟虚空 __thiscall vtkRenderView::ApplyViewTheme(class vtkViewTheme *(" (?ApplyViewTheme@vtkRenderView@@UAEXPAVvtkViewTheme@@@Z( 1>vtkCharts.lib(vtkContextView.obj( : 错误 LNK2001:未解析的外部 符号"受保护:虚拟虚空 __thiscall vtkRenderView::P rocessEvents(class vtkObject *,无符号长,void *(" (?ProcessEvents@vtkRenderView@@MAEXPAVvtkObject@@KPAX@Z(

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

./VTK-build/

VTK-5.6/VTK/Charts/vtkChart.h|38|error: "{"标记之前的预期类名| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error: 'vtkContextItem' 不命名类型| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error: "vtkContextItem"尚未 已声明| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error: 来自类型的无效static_cast "vtkObjectBase*"键入"vtkChart*"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在 成员函数'虚拟 vtkObjectBase* vtkChart::NewInstanceInternal(( 康斯特':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error: "新"不是"vtkChart"的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在 成员函数'虚拟 vtk注释链接* vtkChart::GetAnnotationLink((':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error: 'class vtkChart' 没有命名的成员 "获取调试"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error: 'class vtkChart' 没有命名的成员 "获取类名"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error: 'class vtkChart' 没有命名的成员 "获取类名"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在 成员函数"虚拟虚空" vtkChart::SetGeometry(int, int(':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error: 'class vtkChart' 没有命名的成员 "获取调试"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error: 'class vtkChart' 没有命名的成员 "获取类名"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error: 'class vtkChart' 没有命名的成员 "获取类名"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error: 'class vtkChart' 没有命名的成员 "修改"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在 成员函数 '虚拟 INT* vtkChart::GetGeometry((':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error: 'class vtkChart' 没有命名的成员 "获取调试"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error: 'class vtkChart' 没有命名的成员 "获取类名"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error: 'class vtkChart' 没有命名的成员 "获取类名"| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||在 成员函数"虚拟虚空" vtkChart::GetGeometry(int&, int&(':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error: 'class vtkChart' 没有命名的成员 "获取调试"|

我在两个平台上都使用 vtk 5-6。我想知道会发生此错误的原因。

谢谢。

我没有忘记包含vtkCharts库。

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

相关文章: