# QVTKOpenGLNativeWidget rise unhandled exception (Qt6Core.dll) in debug mode

**URL:** https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132
**Category:** Support
**Tags:** code
**Created:** [April 5, 2023, 12:32am UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132 "2023-04-05T00:32:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![antoine1](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@antoine1](https://discourse.vtk.org/u/antoine1)
#### Post date: [April 5, 2023, 12:32am UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132/1 "2023-04-05T00:32:46Z")

</div>

Hello,

I have a little problem with VTK and QT.

In my QT ui, i added a QVTKOpenGLNativeWidget.  
If i execute the code, which use this widget to plot, in release mode every things is ok and work perfectly but if i execute the code in debug,  
i get an unhandled exception (Qt6Core.dll) in my ui\_PlotWIdget.h at the line:

```auto
qvtkWidget = new QVTKOpenGLNativeWidget(PlotWidget);

```

thank you in advance!

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [April 5, 2023, 6:23pm UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132/2 "2023-04-05T18:23:15Z")

</div>

I have with success using VTK and Qt6 on windows using instead `QVTKOpenGLWidget` and followed the design pattern from `CTK`, where I inherit `ctkVTKOpenGLNativeWidget`. I just cherry-picked the interfacing Qt widgets from `CTK`. I have not had any success with multi configurations, so I create two solution folders, one for debug and one for release, where I use VTK in debug and release, respectively.

---

<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: [April 12, 2023, 11:52am UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132/3 "2023-04-12T11:52:48Z")

</div>

Hello,

Are you in Windows? If so, make sure you’re not mixing debug and release versions of the libraries (e.g. debug versions of VTK DLLs with release versions of Qt DLLs).

If you made sure you’re not mixing them, I suggest you to do this:

```cpp

qvtkWidget = new QVTKOpenGLNativeWidget();

//
//All QVTKOpenGLNativeWidget setup code going before adding it to Qt.
//
(...)

PlotWidget->layout()->addWidget( qvtkWidget );

```

take care,

PC

---

<div class="post-metadata">

### Author: ![antoine1](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@antoine1](https://discourse.vtk.org/u/antoine1)
#### Post date: [April 15, 2023, 6:06pm UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132/4 "2023-04-15T18:06:45Z")

</div>

thank you. I rebuilt and install vtk and now i dont have anymore problems

But i have a question: why the error was raise by qt6core and not qt6cored?

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [April 15, 2023, 8:09pm UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132/5 "2023-04-15T20:09:06Z")

</div>

You must somehow have linked to the release version - otherwise this makes no sense.

---

<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: [April 16, 2023, 2:45pm UTC](https://discourse.vtk.org/t/qvtkopenglnativewidget-rise-unhandled-exception-qt6core-dll-in-debug-mode/11132/6 "2023-04-16T14:45:01Z")

</div>

> [@antoine1](#):
>
> why the error was raise by qt6core and not qt6cored?

First, you need to double check you’re not loading debug and release versions of ALL the dependencies when running/debuging/profiling your application. This particularly holds true with VTK, Qt and Qwt libraries, for example, as they do “risky” operations (e.g. graphics rendering and exchange signals/slots), but this may also be the case for other libraries as well.
