vtkCharts 库既不能与 Visual Studio 一起工作,也不能与 GCC 编译器一起工作 - 为什么?
我是 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) 在函数“protected: __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(类 vtkView主题 *)" (?ApplyViewTheme@vtkRenderView@@UAEXPAVvtkViewTheme@@@Z) 1>vtkCharts.lib(vtkContextView.obj) : 错误 LNK2001:无法解析的外部 符号“受保护:虚拟无效 __thiscall vtkRenderView::ProcessEvents(类 vtkObject *,无符号长整型,void *)” (?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|错误: 来自类型的 static_cast 无效 “vtkObjectBase*”输入“vtkChart*”| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||中 成员函数“虚拟” vtk对象库* vtkChart::NewInstanceInternal() 常量':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|错误: “New”不是“vtkChart”的成员| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||中 成员函数“虚拟” vtk注释链接* vtkChart::GetAnnotationLink()':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|错误: “vtkChart 类”没有名为的成员 '获取调试'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|错误: “vtkChart 类”没有名为的成员 '获取类名'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|错误: “vtkChart 类”没有名为的成员 '获取类名'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||中 成员函数“虚空” vtkChart::SetGeometry(int, int)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误: “vtkChart 类”没有名为的成员 '获取调试'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误: “vtkChart 类”没有名为的成员 '获取类名'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误: “vtkChart 类”没有名为的成员 '获取类名'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|错误: “vtkChart 类”没有名为的成员 “修改”| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||中 成员函数'虚int* vtkChart::GetGeometry()':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误: “vtkChart 类”没有名为的成员 '获取调试'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误: “vtkChart 类”没有名为的成员 '获取类名'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误: “vtkChart 类”没有名为的成员 '获取类名'| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||中 成员函数“虚空” vtkChart::GetGeometry(int&, int&)':| ../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|错误: “vtkChart 类”没有名为的成员 '获取调试'|
我在两个平台上都使用 vtk 5-6。我想知道可能发生此错误的原因。
谢谢。
I'm a newbie to vtk and I want to use the vtkCharts library. In both Linux and Windows, I compiled vtk and managed to work with the most of the examples.
The only troublesome examples arre those including the chart library, such as the one in the link:
When I compile, in Visual Studio it gives some linking errors. A segment is below. I didn't forget to include the vtkCharts library.
1>vtkCharts.lib(vtkContextView.obj) :
error LNK2019: unresolved external
symbol "protected: virtual __thiscall
vtkRenderView::~vtkRenderView(void)"
(??1vtkRenderView@@MAE@XZ) referenced
in function "protected: virtual
__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)
referenced in function "protected:
__thiscall vtkContextView::vtkContextView(void)"
(??0vtkContextView@@IAE@XZ)
1>vtkCharts.lib(vtkContextView.obj) :
error LNK2019: unresolved external
symbol "protected: __thiscall
vtkRenderView::vtkRenderView(void)"
(??0vtkRenderView@@IAE@XZ) referenced
in function "protected: __thiscall
vtkContextView::vtkContextView(void)"
(??0vtkContextView@@IAE@XZ)
1>vtkCharts.lib(vtkContextView.obj) :
error LNK2001: unresolved external
symbol "public: virtual void
__thiscall vtkView::Update(void)" (?Update@vtkView@@UAEXXZ)
1>vtkCharts.lib(vtkContextView.obj) :
error LNK2001: unresolved external
symbol "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)
In Code::Blocks , using GCC, it gives errors like this:
./VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|38|error:
expected class-name before ‘{’ token|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error:
‘vtkContextItem’ does not name a type|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error:
‘vtkContextItem’ has not been
declared|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error:
invalid static_cast from type
‘vtkObjectBase*’ to type ‘vtkChart*’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In
member function ‘virtual
vtkObjectBase*
vtkChart::NewInstanceInternal()
const’:|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|40|error:
‘New’ is not a member of ‘vtkChart’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In
member function ‘virtual
vtkAnnotationLink*
vtkChart::GetAnnotationLink()’:|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error:
‘class vtkChart’ has no member named
‘GetDebug’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error:
‘class vtkChart’ has no member named
‘GetClassName’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|104|error:
‘class vtkChart’ has no member named
‘GetClassName’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In
member function ‘virtual void
vtkChart::SetGeometry(int, int)’:|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error:
‘class vtkChart’ has no member named
‘GetDebug’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error:
‘class vtkChart’ has no member named
‘GetClassName’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error:
‘class vtkChart’ has no member named
‘GetClassName’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|108|error:
‘class vtkChart’ has no member named
‘Modified’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In
member function ‘virtual int*
vtkChart::GetGeometry()’:|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error:
‘class vtkChart’ has no member named
‘GetDebug’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error:
‘class vtkChart’ has no member named
‘GetClassName’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error:
‘class vtkChart’ has no member named
‘GetClassName’|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h||In
member function ‘virtual void
vtkChart::GetGeometry(int&, int&)’:|
../VTK-build/VTK-5.6/VTK/Charts/vtkChart.h|109|error:
‘class vtkChart’ has no member named
‘GetDebug’|
I'm using vtk 5-6 in both platforms. I wonder the reasons why this error might occur.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么您可能忘记包含 vtkHybrid 库。请注意 cmake 文件中的最后一行。
Then you probably forgot to include the vtkHybrid library. Note the last line in the cmake file.