vtk Custom Filter Clarification:

Hello All,

System: VTK-9.2, using gcc-12

I am working on developing some custom filters for vtk, to get started I am using the vtk examples as a guide this example specifically (https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter/).When I try and compile the example I get the following error:

PolyDataAlgorithmReader.cxx:(.text+0x59): undefined reference to `vtkPolyDataAlgorithm::GetOutput()'

I suspect that I am just missing a vtk module in the find_package() command in the CMakelists.txt file, but I cant find any guidance in the documentation for what module needs to be loaded (Tried PolyDataAlgorithim and no luck).

Any help is greatly appreciated in resolving this issue!

That’s true, there are missing modules. The automated cmake generator is only picking up the contents of PolyDataFilter.cxx.
You have two opitions:

  1. (The best) Run VTKModulesForCxx. However you need Python for this.
  2. Look through other examples where the VTK classes are used and add in the missing packages. This link could be really useful here: CxxVTKClassesUsed
1 Like

I have updated the web pages with the modules that you will need, see the find_package statement in the comments on the web page.

Thank you, sorry for the late reply was on a flight. VTKModulesForCxx worked like a charm and a great utility to learn how to develop with VTK so I marked that as the answer!