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

标签 c++ visual-c++ visualization data-visualization vtk

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

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

Line plot example

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

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)

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

./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’|

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

谢谢。

最佳答案

I didn't forget to include the vtkCharts library.

那么您可能忘记包含 vtkHybrid 库。请注意 cmake 文件中的最后一行。

关于c++ - vtkCharts 库既不适用于 Visual Studio 也不适用于 GCC 编译器 - 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6401785/

相关文章:

python - 使用 matplotlib 滚动浏览重叠 3D 图像的 2D 切片

c++ - 函数内部的静态变量与C++中的静态类变量

c++ - 动态创建对象指针数组

c++ getter方法调用构造函数

visual-studio - GCC 与 Visual Studio 一起使用吗?

visual-c++ - C++/CLI Wrapper DLL TypeLoadException 字段太多

c++ - VTK + Cmake-> USE_VTK_RENDERING错误

haskell - 是否有 F# 工具/库将值可视化为图形(如 Haskell 的 vacuum)?

c++ - 如果一个函数类型只依赖于它自己的模板参数,它是否依赖于它?

c++ - MSVC 的 _M_X64 预定义宏说明