我是个新手,我想使用vtkCharts库。在Linux和Windows中,我编译了vtk并设法使用了大多数示例。
唯一麻烦的例子是包括图表库在内的例子,例如链接中的例子:
线图实例
在Visual中,编译时会出现一些链接错误。下面是一个片段。我没有忘记包括vtkCharts库。
1>vtkCharts.lib(vtkContextView.obj):错误LNK2019:未解决的外部符号“受保护:虚拟__thiscall vtkRenderView::~vtkRenderView( void )”(??1 vtkRenderView@@MAE@XZ)在“受保护:虚拟__thiscall vtkContextView:~vtkContextView(Void)”(??1vtkContextView@@MAE@XZ) 1>vtkCharts.lib(vtkContextView.obj)中引用(vtkContextView.obj):error LNK2019:未决外部符号"public: vtkRenderView::SetDisplayHoverText(bool)“(?( vtkRenderView@@UAEX_N@Z)在函数“__thiscall :vtkContextView:vtkContextView(Void)”(??0vtkContextView@@IAE@XZ) 1>vtkCharts.lib(vtkContextView.obj)中引用:错误LNK2019:未解决的外部符号“受保护:__thiscall vtkRenderView::vtkRenderView(void)”(??0vtkRenderView@@IAE@XZ) (??0vtkContextView::vtkContextView::vtkContextView(void)“?1>vtkCharts.lib(vtkContextView.obj):LNK2001:未解决的外部符号"public: vtkRenderView::Update( void )“(?Update@vtkView@@UAEXXZ) 1>vtkCharts.lib(vtkContextView.obj):error LNK2001:未决外部符号"public: virtual __thiscall vtkRenderView::ApplyViewTheme(class vtkViewTheme *)”1>vtkCharts.lib 1>vtkCharts.lib(vtkContextView.obj):error LNK2001:未决外部符号“保护:虚拟无效__thiscall vtkRenderView::ProcessEvents(类vtkObject *,未签名的长,空*)“(?ProcessEvents@vtkRenderView@@MAEXPAVvtkObject@@KPAX@Z)
在代码::块中,使用GCC,它会产生如下错误:
./VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|38|error:预期的类名-在“{‘token ../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_从类型‘vtkObjectBase*’到键入‘vtkChart*’../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In成员函数‘虚拟vtkObjectBase*vtk图表::NewInstance内部()const’:AC.26 ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error:‘New’不是‘vtkChart’\# ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In成员函数‘虚拟vtkAnnotationLink’的成员。*vtkChart::GetAnnotationLink():分部../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error:‘class vtkChart’没有名为“GetDebug”的../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error:‘class vtkChart’类的成员,没有名为“GetClassName”的../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error:‘class vtkChart’类的成员,也没有名为“GetClassName”的成员‘\ ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In成员函数’虚拟void::Set几何学(int,‘:../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error:’class vtkChart‘没有名为“GetDebug”的类的成员,没有名为“GetClassName”的类vtkChart,没有名为“GetClassName”的类vtkChart’,没有名为“GetClassName”的成员。VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error:‘class vtkChart’没有一个成员名为‘Modified’../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In成员函数‘virtual*vtk图表::GetGeometry():AC.26 ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error:’class vtkChart‘没有一个名为“GetDebug”的成员./VTK-构建/VTK-5。6/VTK/Charts/vtkChart.h 109\x\x错误:‘class vtkChart’没有名为‘GetClassName’has ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In‘class vtkChart’类的成员,没有名为‘GetClassName’\\../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In成员函数‘的成员’虚拟无效VTK::GetGe计量(int&,../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error:‘class vtkChart’没有名为“GetDebug”的成员。
我在两个平台上都使用vtk 5-6。我想知道为什么会发生这个错误。
谢谢。
发布于 2011-06-19 13:44:11
我没有忘记包括vtkCharts库。
然后,您可能忘记了包含vtkHybrid库。注意cmake文件中的最后一行。
https://stackoverflow.com/questions/6401785
复制相似问题