RTTI problem with MSVC
-
wrote on 2 May 2025, 07:52 last edited by
I recently moved from Qt 5.15 to Qt 6.8.3. While building went smoothly, the software experienced crashes. I did some experiments and found that the crashes were related to RTTI support. When runtime type information was disabled (as it has been in my projects for years) the software would crash, when enabled, no crashes would occur. I use Visual Studio 2022 for development.
I created a minimum example using the MDI sample within QtCreator. As this is what I want to do in the future, I display QML in the MDI child window via QQuickWidget.When using "Desktop Qt 6.8.3 MSVC2022 64bit", the software works as expected: creating an MDI child displays a QML file.
When I add the following line to the .pro file:QMAKE_CXXFLAGS += /GR-
and rebuild, the software crashes.
When using "Desktop Qt 6.8.3 MinGW 64-bit", the software works as expected.
When I add the following line to the .pro file:QMAKE_CXXFLAGS += -fno-rtti
and rebuild, the software still works as expected.
From this I conclude that there is a problem with RTTI and MSVC.Is my conclusion correct, and if yes, how can I solve the problem? I would like to avoid turning on RTTI support in all of my existing projects.
I have my sample project ready for upload but do not know how to accomplish this.
1/1