Can't run some VTK examples in Qt

Hi,
I installed VTK-8.2.0 from source on Windows x64 with MSVC x64. I upload CMakeCache from CMake GUI.
I can run this example CylinderExample but I can’t run this ParametricKuenDemo.
If I try to run this example I get the application output:

04:05:17: C: \ Users \ Tasik \ Documents \ Qt_prj \ build-VTK-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug \ debug \ VTK.exe starts …
04:05:17: The program ended unexpectedly.
04:05:17: The process was completed forcibly.
04:05:17: C: /Users/Tasik/Documents/Qt_prj/build-VTK-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug/debug/VTK.exe failed.

(spaces were added after translation output via Google Translate :smiley:)
and compiler output:

04:05:17: Steps are being carried out for the VTK project …
04:05:17: Settings have not changed, the qmake stage is skipped.
04:05:17: It starts: "C: \ Qt \ Tools \ qtcreator-4.10.2 \ bin \ jom.exe"
C: \ Qt \ Tools \ qtcreator-4.10.2 \ bin \ jom.exe -f Makefile.Debug
04:05:17: The process “C: \ Qt \ Tools \ qtcreator-4.10.2 \ bin \ jom.exe” completed successfully.
04:05:17: Elapsed time: 00:00.

To run any example I add the following lines (I don’t know exactly why but I found it here https://stackoverflow.com/questions/18642155/no-override-found-for-vtkpolydatamapper:
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);

Does anybody know how to solve this problem?
CMakeCache_VTK_820_debug.txt (107.4 KB)

Are you running the examples from Qt Creator? I get crashes like that when the runtime libraries are not visible (e.g. not in PATH). A program that uses Qt and VTK needs to see Qt’s and VTK’s runtime libraries (DLLs in Windows) otherwise it’ll fail.

Thank you for response,
Yes I run it from QtCreator but I have “C:\apps\MSVC_apps_debug\VTK\bin” directory in my PATH in QtCreator. So that allows me to run some simple examples. I use QMake and I add all libraries via:

LIBS += C:/apps/MSVC_apps_debug/VTK/lib/*.lib
INCLUDEPATH += C:/apps/MSVC_apps_debug/VTK/include/vtk-8.2
DEPENDPATH += C:/apps/MSVC_apps_debug/VTK/include/vtk-8.2

VTK build as shared libraries. I don’t have any idea what is the problem.

Do you have Qt’s DLL directory in PATH too?

Yes, here what I have in PATH that concerns Qt and VTK (I have two QtCreator: one compiled with MSVC 32 and other with MSVC 64):

C:\Qt\Tools\QtCreator\bin;
C:\Qt\Tools\qtcreator-4.10.2\bin;
C:\apps\MSVC_apps_debug\VTK\bin

Please, create a .BAT with the following:

SETLOCAL
set PATH=C:\apps\MSVC_apps_debug\VTK\bin;C:\Qt\Tools\QtCreator\bin;C:\Qt\Tools\qtcreator-4.10.2\bin
VTK.exe

Save it in the same directory of the EXE, open a prompt, go there and run the BAT to get any messages that may help in diagnosing the issue.

Also, triple check whether you are:

  1. not mixing release/debug versions of the libraries/exe;
  2. not mixing 32/64-bit versions of the libraries/exe.

This is critical and leads to many mysterious crashes under Windows.

Thank you, I checked that and that wasn’t the reason :slightly_smiling_face:
I just found the reason why I didn’t get any descriptive errors. The answer was is to turn off the Windows Fault Tolerant Heap and now I get the following error:

cannot open C:\Windows\main.obj.5848.31.jom for write

I dont have any file in that folder with name “main”. I’m going to find the solution for that problem but this is not the VTK error.

1 Like