Hello,
I’m creating a C++ application that can read images and display/render them.
Adding the this header #include <vtk-9.3/vtkImageReader2.h> on one of my hpp file generates the following error:
/usr/local/include/vtk-9.3/vtksys/SystemTools.hxx:6:10: fatal error: vtksys/Configure.hxx: No such file or directory
6 | #include <vtksys/Configure.hxx>
You’re missing VTK’s include directories. You should have them set up via CMake and, failing that, your code needs to have #include <vtkImageReader2.h> and the vtk-9.3 part provided via -I.
Provided that you are using CMake, you can do something along the lines of
cmake_minimum_required(VERSION 3.8)
project(YourProjectName
LANGUAGES
CXX)
find_package(VTK 9.3 REQUIRED COMPONENTS
IOImage
# other packages that you need
)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE
${VTK_LIBRARIES})
I’m completely lost now with VTK, I dont know what I’m missing here. I know in the past it was not easy to setup.
I have built this time VTK8 instead of VTK9 for future dev with Qt library and I used CMake gui version.
I’m developing on a Linux machine and I’m using vscode as IDE.
I included all necessary headers, well part of them, in tasks.json file
If I were you, I would simply clone the ImageViewer in the Examples/GUI/Qt directory. Check if this works with your Qt installation. The examples are self-contained and search for VTK and Qt. Remember that the Qt directory should be the lib/cmake/vtk-8 folder of your Qt build or your Qt installation.
Is it enough ? because I’m still getting this error now:
/home/massilinux/Desktop/Project/ImageReader/ImageRead.hpp:18:10: fatal error: vtkImageReader2.h: No such file or directory
18 | #include <vtkImageReader2.h>