# Errors building vtkGUISupportQt

**URL:** https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111
**Category:** Support
**Created:** [June 25, 2024, 8:11am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111 "2024-06-25T08:11:49Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 25, 2024, 8:11am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/1 "2024-06-25T08:11:49Z")

</div>

I am building VTK 8.2.0 with Qt 5.12.12, using VS 2019. The build for vtkGUISupportQt fails with 27 errors in the compilation of QVTKOpenGLwidget.cxx. It is not obvious to me what the basic problem is, but many of the errors are related to:  
identifier “QOpenGLFunctions\_3\_2\_Core” is undefined.  
but the include file OpenGLFunctions\_3\_2\_Core.h is present.  
Can somebody help?

---

<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 26, 2024, 1:41pm UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/2 "2024-06-26T13:41:10Z")

</div>

8.2.0 is no longer supported, but it should have been tested with Qt 5.12 at the time. Does VTK 9.3 or `master` work?

---

<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: [June 26, 2024, 2:15pm UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/3 "2024-06-26T14:15:15Z")

</div>

This failure could be due to Qt configuration. In that header file, there is an #ifdef block:

```c++
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
...

```

So if Qt was configured for OpenGL ES, or if it was configured for no OpenGL, then QOpenGLFunctions\_3\_2\_Core will not be defined.

How was Qt installed?

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 26, 2024, 8:33pm UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/4 "2024-06-26T20:33:33Z")

</div>

Thanks David. I probably didn’t choose the right OpenGL options when building Qt. Can you tell me what I need to turn on?

![~WRD0000.jpg](https://discourse.vtk.org/uploads/default/original/2X/5/52d5f1c08649212fe6768d2cacdcf8df711810d9.jpeg)

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 26, 2024, 8:42pm UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/5 "2024-06-26T20:42:36Z")

</div>

Do you think I should have built VTK 9.3? I chose an older version because a few years ago I was using Qt 4.8.1, and somehow I got the impression that I needed to stick to older versions for the VTK-Qt combo to work. I was flying blind.

I have problems with W10 at the moment (after resetting) and it’s not a good time to try building VTK again.

---

<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: [June 26, 2024, 9:49pm UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/6 "2024-06-26T21:49:40Z")

</div>

Take a look at [https://doc.qt.io/qt-5/configure-options.html](https://doc.qt.io/qt-5/configure-options.html), it seems that the Qt config option that you want is

```plaintext
configure.bat -opengl desktop

```

If rebuilding Qt doesn’t fix the issue, you can additionally edit GUISupport/Qt/CMakeLists.txt make VTK bring in additional Qt components. For example, where it says

```cmake
find_package(Qt5 COMPONENTS Widgets 

```

change to

```cmake
find_package(Qt5 COMPONENTS Widgets OpenGL

```

and add these:

```cmake
include_directories(${Qt5OpenGL_INCLUDE_DIRS})                                
add_definitions(${Qt5OpenGL_DEFINITIONS})
set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5OpenGL_LIBRARIES})

```

Possibly other stuff is needed as well. All of my advice here is just guesswork.

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 27, 2024, 12:17am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/7 "2024-06-27T00:17:32Z")

</div>

That’s a great help, David. I will try rebuilding Qt (a long process).

Thanks a lot.

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 28, 2024, 5:40am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/8 "2024-06-28T05:40:45Z")

</div>

Hi David. I rebuilt Qt5 with the “-opengl desktop” option, but as far as I can tell the result is identical to what I built before.  
I then tried making the changes you suggested to GUISupport/Qt/MakeLists.txt. I now get the same errors in compiling QVTKOpenGLNativeWidget.cxx.  
I am starting to wonder if it is in fact possible to build VTK with Qt5.  
Thanks again for your suggestions.

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 30, 2024, 12:40am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/9 "2024-06-30T00:40:36Z")

</div>

In case my problem is related to a missing VTK module, I decided to try to build all modules (instead of just those related to Qt.) This gives me a cmake error:

CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):  
Could NOT find Boost (missing: Boost\_INCLUDE\_DIR)

To install Boost, do I need to build it from source?

On a different line of attack: I have been choosing to build Module\_GuiSupportQt, but not Module\_GUISupportQtOpenGL. Is it possible that I need to include the latter module in the build (if I do not build all module, which I currently can’t do, lacking Boost.)

---

<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: [June 30, 2024, 1:04am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/10 "2024-06-30T01:04:59Z")

</div>

Building all modules isn’t going to help you with Qt. Neither will Boost.

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 30, 2024, 5:19am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/11 "2024-06-30T05:19:39Z")

</div>

Thanks for that info, saving me from wasting more time.  
I found that on GitHub Martijn Koopman has instructions for building Qt 5.13 and VTK 8.2: Qt-VTK-viewer. This looks promising, but the instructions specify, among other things that I have been doing, turning on:  
VTK\_BUILD\_QT\_PLUGIN  
and  
Module\_vtkViewsQt  
neither of which shows up in my configure with cmake\_GUI. I don’t understand this.  
I have tried to send a message to Martijn, via his website, but there’s no guarantee that he’ll be interested in fielding a query about this.

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 30, 2024, 5:25am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/12 "2024-06-30T05:25:00Z")

</div>

I forgot to mention that Martijn’s method builds VTK first (which is puzzling, because the build requires various cmake Qt options to be specified) then builds Qt with Qt Creator.

---

<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: [June 30, 2024, 2:08pm UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/13 "2024-06-30T14:08:10Z")

</div>

It shouldn’t be necessary to build Qt from source, since Qt 5.12 comes with a binary installer for Windows (qt-opensource-windows-x86-5.12.12.exe). I’ve never used this specific version of the installer, but I used the binary installer for Qt 5.9 (many years ago) and I don’t remember any particular difficulties building VTK with it.

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [June 30, 2024, 10:32pm UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/14 "2024-06-30T22:32:43Z")

</div>

I’ll look into the binary installation. It would be great if that enables VTK to be built with Qt5. I need 64-bit VTK, so that will need to be checked.

Thanks.

---

<div class="post-metadata">

### Author: ![gib](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gib/32/9201_2.png) [@gib](https://discourse.vtk.org/u/gib)
#### Post date: [July 19, 2024, 6:53am UTC](https://discourse.vtk.org/t/errors-building-vtkguisupportqt/14111/15 "2024-07-19T06:53:04Z")

</div>

Hi David,

I finally got around to the binary install of Qt 5.12.12 as you suggested, and attempted to build VTK-8.2.0 with module\_vtkGUISupportQtOpenGL. I get a great number of errors in the compilation of QVTKOpenGLNativeWidget.cxx, again related to QOpenGLFunctions\_3\_2\_Core. There seems to be an incompatibility, related to OpenGL 3. Time to give up, I think.

Best regards,

Gib
