# fatal error: vtkVersion.h: no such directory or file

**URL:** https://discourse.vtk.org/t/fatal-error-vtkversion-h-no-such-directory-or-file/10793
**Category:** Support
**Tags:** code
**Created:** [February 25, 2023, 3:19am UTC](https://discourse.vtk.org/t/fatal-error-vtkversion-h-no-such-directory-or-file/10793 "2023-02-25T03:19:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![liuyankui-1998](https://discourse.vtk.org/user_avatar/discourse.vtk.org/liuyankui-1998/32/6618_2.png) [@liuyankui-1998](https://discourse.vtk.org/u/liuyankui-1998)
#### Post date: [February 25, 2023, 3:19am UTC](https://discourse.vtk.org/t/fatal-error-vtkversion-h-no-such-directory-or-file/10793/1 "2023-02-25T03:19:45Z")

</div>

I downloaded a project from github and ran it through vs code on ubantu, but vs code told me that I couldn’t find the header files,But I can trace these header files like vtkVersion.  
Here is my cmakeLists.txt：

 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/bb1c94aba28676ba3bc083cf84586f5a7bf27e36.png)  
Here is my terminal:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/3/399bc8d1184f6647e5f7e6857f3fef3d17b4943f.png)  
Here is my head files:  
None of these header files can be found.  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/1/13c200e4b5644a8fb48a8d6f65af3a5fcfda02a1.png)  
here is vtkVersion.h  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/d/d49c1fb017989c762df80aa3f121863540405b7f.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 27, 2023, 8:47am UTC](https://discourse.vtk.org/t/fatal-error-vtkversion-h-no-such-directory-or-file/10793/2 "2023-02-27T08:47:47Z")

</div>

Looks like old code. Checkout the example for modern VTK code: [https://kitware.github.io/vtk-examples/site/](https://kitware.github.io/vtk-examples/site/)

---

<div class="post-metadata">

### Author: ![liuyankui-1998](https://discourse.vtk.org/user_avatar/discourse.vtk.org/liuyankui-1998/32/6618_2.png) [@liuyankui-1998](https://discourse.vtk.org/u/liuyankui-1998)
#### Post date: [February 27, 2023, 11:59am UTC](https://discourse.vtk.org/t/fatal-error-vtkversion-h-no-such-directory-or-file/10793/3 "2023-02-27T11:59:54Z")

</div>

hello:  
I have tested the new version of the sample code, but the same problem still exists: the header file cannot be found for seconds. I think there may be a problem with the header file search path configuration of g++。  
here is the includepath.json:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/7/7f1045e526fb8cafb4e3b7b1d096940bd849d494.png)  
This is the path where my header file is located：  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/8/8f5ed2fcea7347220819ebccd536bfab9300c860.png)  
According to the online data, it is not necessary to configure environment variables for installing vtk in the ubantu system, so I think it is not the environment variables that have problems.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [February 27, 2023, 2:50pm UTC](https://discourse.vtk.org/t/fatal-error-vtkversion-h-no-such-directory-or-file/10793/4 "2023-02-27T14:50:47Z")

</div>

With VTK 9, there are two ways to get the libraries and include directories that you need.

The first way is to list the modules that you need in the `find_package` statement. Then you can use `${VTK_LIBRARIES}` for linking:

```plaintext
find_package(VTK COMPONENTS CommonCore FiltersCore IOImage)
...
target_link_libraries(NewMarchingCubes PRIVATE ${VTK_LIBRARIES})

```

The second way is to list the individual libraries with `target_link_libraries()`:

```plaintext
find_package(VTK REQUIRED)
...
target_link_libraries(NewMarchingCubes PRIVATE VTK::CommonCore VTK::FiltersCore VTK::IOImage)

```

The include directories are automatically set when you use `target_link_libraries()`.
