I’m running one of the VTK Qt examples and I’m not sure if I’m doing this correctly. I’ve configured and generated on CMake, then built on Visual Studio, then used Command Prompt to open the executable file however I get the following error:
I have Qt creator 4.11.1 (Community)
Please provide assistance
Are the Qt DLLs in your
PATH environment variable? They need to be there for the examples to work.
do you mean like this on CMake?
No, I mean in the
PATH environment variable.
CMake only resolves paths to build your program. To run your program, the OS needs to know where to find DLLs. So, you either:
- Do like @ben.boeckel said;
- Copy all the required DLLs to a deploy directory along the excutable and run it there;
- Create a launcher .BAT like this if you don’t want (or can’t) change your OS environment or don’t want to keep a deploy directory:
set PATH=C:\<Qt´s install path>\5.13\msvc2015_64\bin;%PATH%
setlocal ensures the PATH setting is only valid when the program runs and does not change your environment permanently.
The same rationale applies to other libraries that your program may be linked to (like VTK itself).
Hi, I am using “qt+cmake+vtk” for developing now, Normally, I down examples from vtk’s web, then build them in the qt with cmake. if you want to publish them into other computers or to excute them in the system, you can use “windeployqt.exe” in win10 system, it will create the package for excuting with dll files of qt, and in sure that the vtk package path is in the evironment of system.
Here’s the DLLs I have to distribute with my application. Yours will likely to be different, since you’re building with Visual Studio and you use only Qt and VTK. This list shows that, in addition to Qt and VTK, you have to distribute the Visual Studio runtime and other possible libraries you may use in the future as well.