Installation of VTK library with Visual Studio Community 2022 on Windows 10

mauede 221 Reputation points
2023-07-04T09:15:39.45+00:00

I amusing Visual Studio Community 2022 for C++ to install the Visualization Tool Kit (VTK) on a Windows 10 PC.

I literally followed the procedure on the following website Building VTK using Visual Studio on Windows

I downloaded the VTK source code into the "src" folder. I used CMake and Visual Studio. After the building phase the "bin" folder was populated with the VTK library (.dll).

I tested the VTK library installation using the example suggested in the procedure https://kitware.github.io/vtk-examples/site/Cxx/Picking/HighlightPickedActor/

Unluckily, when I run the example with Visual Studio I get the following error message "The code execution cannot proceed because vtkRenderingOpenGL2-9.2.dll was not found. Reinstalling the program may fix this problem" I am not clear about which program should be reinstalled. Is it Visual Studio, or VTK, or the example test?

I tried adding the path of the VTK library (.dll) to my username environment variable PATH. It did not solve the problem.

I tried to install the VTK library (.dll) as a subfolder of Program Files. It did not solve the problem.

I am at my wits' end

Should I try to add the VTK library as part of the References or External Dependencies in Visual Studio?

If the answer is "yes" then how can I do that?

I have some limited experience of Visual Studio with C# for which I had followed some examples showing how to add NuGet packages and dependencies. I have no such experience with C++.

I would appreciate some help at implementing C++ codes that successfully call the VTK library (.dll) for image rendering

Thank you in advance

Maura E. M.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,377 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,834 questions
{count} votes

Accepted answer
  1. Minxin Yu 12,506 Reputation points Microsoft Vendor
    2023-07-05T07:56:10.9933333+00:00

    Hi, @mauede

    Since the exe has been built, the DLL exists. You just haven't added the correct path.

    From the SO thread you post:

    \vtk\build\bin is added to environment variable PATH.

    vtkRenderingOpenGL2-9.2.dll is release version. The Release folder needs to be added to PATH.
    XXX\XXX\vtk\build\bin\Release

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.