How to make Visual Studio resolve the VTK <include> directives

mauede 221 Reputation points
2023-07-05T21:14:08.7933333+00:00

The path to VTK<include> files is: C:\Program Files\VTK\include\vtk-9.2

My env. variable PATH value is:

C:\Users\MMONVILL>path
PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\MinGW\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Git\cmd;C:\vcpkg\vcpkg-master;C:\Program Files\CMake\bin;C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;C:\Program Files\VTK\bin;C:\Users\MMONVILL\AppData\Local\Microsoft\WindowsApps;C:\Program Files\VTK\bin;

I am trying to develop a simple program that uses VTK. Visual Studio 2022 cannot resolve any directives #include <vtk-something.h> Despite making the changes to the project Properties displayed in the attached pictures

VS1.png VS2.png VS3.png

Questions:

The VTK path added to the env. variable does not contain the VTK <include>. Maybe I should modify it to just "C:\Program Files\VTK" so that all the subfolders of VTK would be searched. Can this be the cause of the problem with Visual Studio?

When I edit Visual Studio project Properties shall I click on "edit" for the selected field or may I just type into the field, which I did?

Should I use CMake to build my program and then use Visual Studio just to run the project? I have tested the VTK installation on a VTK example built with CMake. Visual Studio was only used to run the project. It works fine.

If I have to use CMake, I appreciate some help generating the CMake list of directives..

Thank you very much

VS1

VS2

VS3

Developer technologies | C++
Developer technologies | 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.
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
{count} votes

Answer accepted by question author
  1. Minxin Yu 13,506 Reputation points Microsoft External Staff
    2023-07-06T03:05:20.6633333+00:00

    Hi,

    make Visual Studio resolve the VTK <include> directives

    You can compare the difference between the Visual Studio project HighLightPickedActor generated with cmake sample and the project you created manually:

    Copy the project HighLightPickedActor's header path (Additional Options) to your project.

    %(AdditionalOptions) /external:I "XXX/build/Common/Color" /external:I "XXX/VTK-9.2.6/Common/Color" /external:I "XXX/build/Common/Core" /external:I "XXX/VTK-9.2.6/Common/Core" 
    many lines left
    .....
    

    User's image

    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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.