This looks like you did not set the VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES" when running configure in CMake.
Note: the abovementioned option names are only applicable for VTK >= 9; for VTK < 9, they are called Module_vtkGUISupportQt and Module_vtkViewsQt (and you might also need to enable Module_vtkGUISupportQtOpenGL and Module_vtkRenderingQt).
These options are not enabled by default, but they seem to be required by the example that you're trying to compile.
Don't worry, you shouldn't have to re-do everything now. To fix:
- Open the CMake GUI.
- Enter the folder where you built VTK in "Where to build the binaries".
- If it's not checked, set the "Advanced" checkbox (the required options are not visible otherwise).
- Set
VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES" - Press "Configure", and wait for it to finish
- During Configuring, you might get an error, if CMake doesn't know how to find Qt; if so, enter the Qt5_DIR / Qt6_DIR, and press configure again.
- Press "Generate", and wait for it to finish
- Start the vtk build again (depends on what build tool you choose...)
- Try configuring the example again, now you should not see the error message anymore.