Configuring VTK with Qt in windows

Hello,

I have installed Qt 5.12.5 on my Wiindows 10 computer. I also have VTK 8.2.0 and cmake.
I have followed following tutorial.
https://vtk.org/Wiki/VTK/Configure_and_Build

I have compiled the VTK using cmake gui with qt. But when I am trying to build “vtk.sln” file in Visual Studio 15 2017, by building “All_BUILD”,
It is showing " Build: 129 succeeded, 6 failed".

What should I do to build all files successfully? Please provide me solution.

It appears as though you either have a 32bit Qt and are building 64bit or have 64bit Qt and are building 32bit. I suspect the latter based on your generator on the right. There should be a selection somewhere to make “Win64” binaries in the GUI. You’ll need to clean your build and start from scratch to change architectures.

I have 64bit Qt. But in Visual studio 15 2017, it is building with Win32 configuration (Release mode). Do I have to change it? And how to change it?

There should be an option when you’re choosing the generator in the GUI for a new build tree.

That option is “Optional platform for generator (…)” shown here:

image

Set it to x64 and you should be good to go.

You will need to either delete all the files in your current build directory or start with a fresh configuration in a new build directory. Once the generate is set, it cannot be changed in the same build directory.

Thank you. It is working now. But after building ALL_BUILD and INSTALL in Visual studio 2017, I am trying to run VTK example “/SideBySideRenderWindowsQt” using Cmake gui.
But it is showing me following error.

CMake Error at C:/VTK/vtk/lib/cmake/vtk-8.2/VTKConfig.cmake:9 (set):
Syntax error in cmake code at

C:/VTK/vtk/lib/cmake/vtk-8.2/VTKConfig.cmake:9

when parsing string

C:\VTK\vtk/lib/cmake/vtk-8.2

Invalid escape sequence \V
Call Stack (most recent call first):
CMakeLists.txt:9 (find_package)

Is it problem because of CMAKE_INSTALL_PREFIX? Earlier it was of Program files (x86), but i changed it to other directory.
What should i do now to run vtk examples with qt?

CMake want’s forward slashes (/) instead of backslashes. Just change CMAKE_INSTALL_PREFIX to C:/VTK/vtk.

I changed it. but it is still showing the same error.

I should have been more specific. Change it in your VTK configuration, not this project configuration.

Thanks. It is working now.