[Qt + VTK] Install VTK with Qt Integration using CMake-GUI (Linux & Windows)

If you already finished installing VTK, let's try the examples to read single DICOM file and DICOM file series.
1. Download Cmake-GUI and install:

    1. Open the Synaptic Manager, search for the Cmake-gui then install it.
    2. Open terminal, then type apt-get install cmake-qt-gui
    3. Download and install it from source: http://www.cmake.org/cmake/resources/software.html

2. Download the latest VTK library here and extract it to your preferred folder.
3. Open CMake-GUI
4. To make sure it won't conflict with other resources, open File->Delete Cache
5. Click the "Browse Source" button and choose the VTK source folder you have already extracted (In this example would be /home/user/VTK5.10.1)

6. Click the "Browse Build" button and choose the folder destination you want the VTK to be built.

7. Click Configure, then specify the makefile generator, the default configuration is "Unix Makefiles" in Linux system and in Windows it would be "MinGW" or "Visual Studio" it depends on what you prefer, if you are finished click the Finish button.

8. Wait a minute for cmake configuring the first configuration for you. It will show you lots of default make configuration, for more entries check the "Advanced" checkbutton.
9. If you want VTK integrated with Qt, check the VTK_USE_QT and VTK_USE_GUISUPPORT option in Advanced entries. Actually, there are many other configurations, you may check them if you want to enable it, so you don't have to build it again later.
10. After finishing the configuration, click "Configure" button, then finish it with clicking "Generate" button for cmake generating the make file.

For Linux:
11. Open the terminal, change directory to the folder you had choosen to build the VTK in the cmake-gui. (command "cd /folder/VTK/build")
12. Compile the make file, if you have a multi-core processor, you can parallel the make processing. (command "make" or "make -j<number of jobs to be paralleled>"->example : make -j4 , if you have 4 processor cores)
13. Your VTK library is already compiled.

For Windows:
11. If you choosed the "Visual Studio" in step 7, then open Visual Studio, Open file and choose the BUILD_ALL.SLN.
12. After visual studio successfully load all the files, choose BUILD SOLUTION
13. Your VTK library is already compiled.


  1. Thanks a lot for your walk-through!

    On windows 7 64 bit with gcc it turned out to be not very easy. I have tried many combinations of shells and settings without any success, but finally succeeded by selecting 'MSys build' during step 7, subsequently performing the 'configure' and 'generate' steps and then running 'make' in the configured build directory from the MSys shell included with MinGW (GNU Make 3.82)

    Then, after placing the libQVTKWidget.dll in the designer's plugins directory, the VTK widget would not show in the Qt Designer that is integrated into QtCreator 2.6.0 :/ After trying several things i found out that it does show if I use the standalone designer included with the QtSdk 4.8.1. Not perfect, but it works :)

  2. Hi,
    your guide was really helpful, but I have a little problem.
    when I use cmake-gui to built my project the two options VTK_USE_QT & VTK_USE_QTGUISUPPORT aren'available.
    I triend and add them manually, but after generating the cmake process returns me a warning telling that those two entries weren't used by the project.
    Coul you explain me why, is there any orrible mystake I make?
    Would you be soo polite and halp me.
    Thanks in advance

    1. Hello Vito, thank you for passing by my blog.
      I think you should tick the advance options for the VTK_USE_QT & VTK_USE_QTGUISUPPORT options.
      Because there are several options not shown in the default category.

      If it's still no options for what you are looking for, maybe your configuration file is wrong.

    2. Hi again,
      I solved the problem, it was due to the fact that I was installing vtk-6.0, where the options are different. I had many problems with that version, so I downgraded to the previous one vtk-5.10.1.
      Now I'testing your example at "http://hxr99.blogspot.com/2013/03/qt-vtk-displaying-single-dicom-file.html" , but I have the problem that when I try and run your project, I get the message: "error while loading shared libraries: libvtkCommon.so.5.10: cannot open shared object file: No such file or directory".
      I would be very grateful if you were able and help me somehow.
      Best regards

    3. Just download the GDCM library : http://gdcm.sourceforge.net/wiki/index.php/Downloads
      It is a additional library supporting DICOM files..

  3. I failed when i test that method using qt5.2.1 and vtk6.1.0 and mingw. I totally don't why it will throw out errors when i compile using mingw. It will be wonderful if you give me some advice.