# Error when compiling VTK support for opencascad?

**URL:** https://discourse.vtk.org/t/error-when-compiling-vtk-support-for-opencascad/11637
**Category:** Support
**Created:** [June 8, 2023, 8:13am UTC](https://discourse.vtk.org/t/error-when-compiling-vtk-support-for-opencascad/11637 "2023-06-08T08:13:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [June 8, 2023, 8:13am UTC](https://discourse.vtk.org/t/error-when-compiling-vtk-support-for-opencascad/11637/1 "2023-06-08T08:13:08Z")

</div>

When compiling the latest OCC:

```auto
commit 8748042259f22d72b3b076bc5433a54ca42734e4 (origin/master, origin/HEAD)
Author: akaftasev <akaftasev@opencascade.com>
Date: Mon May 22 12:00:32 2023 +0100

```

against VTK V9.2.6,I got this error:

```auto
In file included from /usr/include/GL/glx.h:30,
                 from /home/alex/workspace/OCCT/src/IVtkDraw/IVtkDraw_Interactor.cxx:23:
/usr/local/include/vtk-9.2/vtksys/Status.hxx:15:21: error: expected identifier before ‘int’
   15 | class vtksys_EXPORT Status
      | ^ ~~~~~
In file included from /usr/local/include/vtk-9.2/vtksys/SystemTools.hxx:7,
                 from /usr/local/include/vtk-9.2/vtkSetGet.h:35,
                 from /usr/local/include/vtk-9.2/vtkObject.h:46,
                 from /usr/local/include/vtk-9.2/vtkCommand.h:235,
                 from /usr/local/include/vtk-9.2/vtkRenderWindowInteractor.h:48,
                 from /usr/local/include/vtk-9.2/vtkXRenderWindowInteractor.h:35,
                 from /home/alex/workspace/OCCT/src/IVtkDraw/IVtkDraw_Interactor.cxx:31:
/usr/local/include/vtk-9.2/vtksys/Status.hxx:16:1: error: expected unqualified-id before ‘{’ token
   16 | {
      | ^
make[2]: *** [src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/build.make:104: src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw_Interactor.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3656: src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

```

It seems that some vtk macros don’t get recognized,and I have tried to add this:

`include_directories("/usr/local/include/vtk-9.2")`

into  
`/home/user/OCCT/adm/cmake/vtk.cmake`,

but got no luky,Question is:

Can this issue be fixed by modifying vtk.cmake?  
If yes,how?

---

<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: [June 8, 2023, 8:30am UTC](https://discourse.vtk.org/t/error-when-compiling-vtk-support-for-opencascad/11637/2 "2023-06-08T08:30:50Z")

</div>

Looks like an opencascade issue.

---

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [June 8, 2023, 9:40am UTC](https://discourse.vtk.org/t/error-when-compiling-vtk-support-for-opencascad/11637/3 "2023-06-08T09:40:26Z")

</div>

Maybe,but same OCC code can be compiled with vtk-9.1 successfully.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [June 9, 2023, 1:19pm UTC](https://discourse.vtk.org/t/error-when-compiling-vtk-support-for-opencascad/11637/4 "2023-06-09T13:19:10Z")

</div>

Hello,

I’m using VTK 9.1 and I found that `vtksys_EXPORT` is defined in `vtksys/Configure.h` which is the header used for C. So, please, check whether your final `vtksys/Configure.hxx` #includes `vtksys/Configure.h`. If not, VTK’s CMake scripts are likely not generating the former correctly from `Utilities/KWSys/vtksysConfigure.hxx.in` in VTK source directory, which, in turn, must have these lines:

```cpp
/* Include C configuration. */
#include <@KWSYS_NAMESPACE@/Configure.h>

```

take care,

PC

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [June 18, 2023, 1:23pm UTC](https://discourse.vtk.org/t/error-when-compiling-vtk-support-for-opencascad/11637/5 "2023-06-18T13:23:46Z")

</div>

The core error is that `Status` is `#define`’d by X11 headers. The “proper” fix is to reorder the includes so that VTK headers come before X11 headers. Newer VTK has checks that detect and error in this case.
