# Can't run some VTK examples in Qt

**URL:** https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242
**Category:** Support
**Created:** [December 9, 2019, 4:48pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242 "2019-12-09T16:48:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![kerim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kerim/32/1175_2.png) [@kerim](https://discourse.vtk.org/u/kerim)
#### Post date: [December 9, 2019, 4:48pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/1 "2019-12-09T16:48:51Z")

</div>

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](https://lorensen.github.io/VTKExamples/site/Cxx/GeometricObjects/CylinderExample/) but I can’t run this [ParametricKuenDemo](https://lorensen.github.io/VTKExamples/site/Cxx/GeometricObjects/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 😃)  
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](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](https://discourse.vtk.org/uploads/short-url/zz9zFrvQvZcrgn5j7kl1cjWdb9n.txt) (107.4 KB)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 10, 2019, 2:32pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/2 "2019-12-10T14:32:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![kerim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kerim/32/1175_2.png) [@kerim](https://discourse.vtk.org/u/kerim)
#### Post date: [December 10, 2019, 2:39pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/3 "2019-12-10T14:39:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 10, 2019, 3:22pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/4 "2019-12-10T15:22:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![kerim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kerim/32/1175_2.png) [@kerim](https://discourse.vtk.org/u/kerim)
#### Post date: [December 10, 2019, 3:27pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/5 "2019-12-10T15:27:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 10, 2019, 3:34pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/6 "2019-12-10T15:34:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 10, 2019, 3:37pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/7 "2019-12-10T15:37:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![kerim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kerim/32/1175_2.png) [@kerim](https://discourse.vtk.org/u/kerim)
#### Post date: [December 10, 2019, 4:02pm UTC](https://discourse.vtk.org/t/cant-run-some-vtk-examples-in-qt/2242/8 "2019-12-10T16:02:49Z")

</div>

Thank you, I checked that and that wasn’t the reason 🙂  
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](https://stackoverflow.com/questions/5020418/how-do-i-turn-off-the-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.
