[vtkusers] Linker Error vtkCharts and BUILD_SHARED_LIBS

Marcus D. Hanwell marcus.hanwell at kitware.com
Thu May 31 20:29:29 EDT 2012


On Wed, May 30, 2012 at 8:04 AM, Hagen Mölle <h.moelle at googlemail.com> wrote:
> Hi,
>
> I recently migrated from vtk5.8 to vtk5.10. I compiled/linked vtk5.10 with BUILD_SHARED_LIBS enabled.
>
> When compiling my own program I receive the following linker error.
>
> ../externals/libvtk/libvtk.a(CVTKMyChartXY.cpp.o): In function `CVTKMyChartXY::MouseButtonReleaseEvent(vtkContextMouseEvent const&)':
> CVTKMyChartXY.cpp:(.text+0x5f8f): undefined reference to `vtkContextMouseEvent::GetModifiers() const'
> CVTKMyChartXY.cpp:(.text+0x5fbf): undefined reference to `vtkContextMouseEvent::GetModifiers() const'
> ../externals/libvtk/libvtk.a(CVTKMyChartXY.cpp.o): In function `CVTKMyChartXY::KeyPressEvent(vtkContextKeyEvent const&)':
> CVTKMyChartXY.cpp:(.text+0x700e): undefined reference to `vtkContextKeyEvent::GetKeyCode() const'
>
> When compiling/linking vtk5.10 with BUILD_SHARED_LIBS disabled my own program links without problems.
>
> This problem occurs on Windows XP, Windows 7, Ubuntu 10.04, Ubuntu 12.04.
>
> I briefly looked at the source code of vtkContextKeyEvent and vtkContextMouseEvent. I could not find anything suspicious.
>
They may be missing the charts export macro, and because of the way
you are using them you would see that on Windows. I will backport a
patch for the 5.10.1 release, but you can easily patch your local tree
by adding VTK_CHARTS_EXPORT before the two class names to verify that
their symbols are then available to you.

> Before I make a bug report I wanted to know, do I need to add any special things to my own project when building vtk with BUILD_SHARED_LIBS enabled?
>
No, I spotted this error when modularizing but the patch will need to
be backported to the stable branch.

Marcus



More information about the vtkusers mailing list