vtksys/Configure.hxx

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>

what is this Configure.hxx file? how to fix that?

Thanks in advance!

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})

Many thanks for your reply!

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

				/* VTK includes */
				"--include-directory=/home/massilinux/VTK8/src/**",
				"--include-directory=/home/massilinux/VTK8/build/**",
                "--include-directory=/home/massilinux/VTK8/src/Interaction/Image",
                "--include-directory=/home/massilinux/VTK8/src/Rendering/Core",
                "--include-directory=/home/massilinux/VTK8/src/Common/ExecutionModel",
                "--include-directory=/home/massilinux/VTK8/src/IO/Image",
				"--include-directory=/home/massilinux/VTK8/src/Common/Core",
				"--include-directory=/home/massilinux/VTK8/build/Common/Core",
				"--include-directory=/home/massilinux/VTK8/build/IO/Image",
				"--include-directory=/home/massilinux/VTK8/build/Common/ExecutionModel",
				"--include-directory=/home/massilinux/VTK8/build/Interaction/Image",
				"--include-directory=/home/massilinux/VTK8/build/Rendering/Core",
				"--include-directory=/home/massilinux/VTK8/build/Filters/Core",
				"--include-directory=/home/massilinux/VTK8/build/Utilities/KWIML",
				"--include-directory=/home/massilinux/VTK8/src/Utilities/KWIML/vtkkwiml/include/kwiml",
				"--include-directory=/home/massilinux/VTK8/src/Utilities/KWIML/vtkkwiml/",

All these includes seems laborious and the compilation still complain about missing header such as:

/home/massilinux/VTK8/build/Utilities/KWIML/vtk_kwiml.h:19:10: fatal error: vtkkwiml/abi.h: No such file or directory
   19 | #include "vtkkwiml/abi.h"

I dont know why this header for reading just a PNG file. Any thoughts?

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.

I would also suggest that you install VTK before using it; you should only need a handful of include paths, not one per module.

KWIML is used to know what 64bit types (long, long long, __int64) are available.

Thanks for your reply,
This is my c_cpp_properties file

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/*",
                "/home/massilinux/VTK8/include/**",
                "/usr/local/Qt-5.15.2/include/**",
                "/usr/local/Qt-5.15.2/lib/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-clang-x64"
        }
    ],
    "version": 4
}

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>

here is my code where the error occurs

/// @headerfile External headers
#include <vtkImageReader2.h>

/// @brief 
namespace IMG
{
/// @brief 
/// @tparam T 
template < typename T = vtkImageReader2 >
class ImageRead : public IReader
{
public:
    /// @brief 
    ImageRead();
    /// @brief 
    ~ImageRead() = default;
    /// @brief 
    /// @param filepath 
    /// @return 
    auto setFileName(const char * filepath) -> void override;
    /// @brief 
    auto display() -> void override;
    /// @brief 
    /// @return 
    vtkAlgorithmOutput *getOutput() const override;
private:
    std::unique_ptr<T> mptr {nullptr};
};
} // namespace IMG

It’ll fail if vtkImageReader2’s module is not enabled (IO/Image).

I would really suggest that you use CMake. It will add the necessary include directories (they are many) both for VTK and Qt.