Hello,
I’m on Windows 11 and have been really struggling to include VTK into the QT. I am very new to VTK. I have built and installed VTK (via ninja) by enabling the following configurations set using cmake-gui
:
VTK_GROUP_Qt
set toYES
VTK_QT_VERSION
set to6
-DVTK_MODULE_ENABLE_GUISupprtQt
set toYES
- I have also
set QML2_IMPORT_PATH=/path/to/vtk/lib/qml/VTK.9.3
andset QML_IMPORT_PATH=/path/to/vtk/lib/qml/VTK.9.3
intocmd
.
Now, I have a Qt project in another directory, whose tree is as follows:
VTK Project
| + build
| | + Desktop_Qt_6_7_2_MSVC2019_64bit-Debug
| - CMakeLists.txt
| - CMakeLists.txt.user
| - main.cpp
| - Main.qml
and my VTK installation directory tree looks like this:
VTKBin
| + bin
| | - vtkcgns-9.3d.dll ... (.dll files)
| + include
| | + vtk-9.3
| | | + Octree ...
| | | - QQuickVTKRenderWindow.h ... (.h files)
| + lib
| | + cmake
| | | + vtk-9.3
| | | | - FindCGNS.cmake ... (.cmake files)
| | + qml
| | | + VTK.9.3
| | | | - plugins.qmltypes
| | | | - qmldir
| | | | - qmlvtkplugin.dll
| | + vtk-9.3
| | - vtkcgns-9.3.lib ... (.lib files)
| + share
| | + licenses
| | + vtk-9.3
In my Qt project, I have added the following to the CmakeLists.txt
(VTK_DIR
points to /VTKBin/lib/cmake/vtk-9.3
)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
include_directories("C:/VTKBin/include/vtk-9.3/")
add_subdirectory(${VTK_DIR})
When I want to add the following into the main.cpp
in order to setting up Graphics Backend (as explained in official Doxygen page here), I use QQuickVTKRenderWindow::setupGraphicsBackend();
but I get a LNK2019: unresolved external symbol
error for it. Please, please help me! (or at least give me a hint of official vtk docs for this!)
Thank you so much in advance,
Regards