VTK-9.1.0.rc2: vtkPoissonDiskSampler error: ld returned 1

I built VTK myself on two systems (arch & ubuntu hirsute) and changed the PolyDataPointSampler example to use the PoissonDiskSampler. On both systems I get the following error while compiling:

$ make
Scanning dependencies of target PolyDataPointSampler
[ 50%] Building CXX object CMakeFiles/PolyDataPointSampler.dir/PolyDataPointSampler.cxx.o
[100%] Linking CXX executable PolyDataPointSampler
/usr/bin/ld: CMakeFiles/PolyDataPointSampler.dir/PolyDataPointSampler.cxx.o: in function `vtkNew<vtkPoissonDiskSampler>::vtkNew()':
PolyDataPointSampler.cxx:(.text._ZN6vtkNewI21vtkPoissonDiskSamplerEC2Ev[_ZN6vtkNewI21vtkPoissonDiskSamplerEC5Ev]+0x11): undefined reference to `vtkPoissonDiskSampler::New()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/PolyDataPointSampler.dir/build.make:137: PolyDataPointSampler] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/PolyDataPointSampler.dir/all] Fehler 2
make: *** [Makefile:103: all] Fehler 2

This filter is part of FiltersPoints module. Can you try adding this module in your CMakeLists.txt? It was not present in the example’s.

1 Like

Thanks for the hint - it is working now.

In another project I just added find_package(VTK REQUIRED) and got the same error. Can you tell me when I need to add modules to it? Thanks!

If you use Python, then this may help in finding the needed modules VTKModulesForCxx/

1 Like

I use c++ but it is still a good starting point.