Problems migrating from 5.14.2 tp Qt 6.8.0
-
Hey all, so I've finally decided on migrating a proyect of mine from the old 5 days to the new 6.8 days.
However, upon rewriting everything to use CMake, and going through fixing the new directory structure I chose to use, I'm having an issue.Apparently my CMakeList is not poiting towards the correct main.cpp file. Why do I say this? I created the empty widgets app proyect and populated it later. However, the first thing the output of the program calls for is "QWidget: Cannot create a QWidget without QApplication", but the first lines of the main file states:
[code]QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); if (qgetenv("QT_FONT_DPI").isEmpty()) { // Prompted to change the way of checking this qputenv("QT_FONT_DPI", "84"); } QApplication a(argc, argv); qDebug() << "Comenzando"; // This line, never shows qDebug() << QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionString(); QString debug; if (QSslSocket::supportsSsl() ) debug = "Soporta SSL"; else debug = "No soporta SSL"; debug+= " version SSL:" + QSslSocket::sslLibraryVersionString() + " ->" + QSslSocket::sslLibraryBuildVersionString(); (...)
[/code]
Am I missing something?
-
Hey all, so I've finally decided on migrating a proyect of mine from the old 5 days to the new 6.8 days.
However, upon rewriting everything to use CMake, and going through fixing the new directory structure I chose to use, I'm having an issue.Apparently my CMakeList is not poiting towards the correct main.cpp file. Why do I say this? I created the empty widgets app proyect and populated it later. However, the first thing the output of the program calls for is "QWidget: Cannot create a QWidget without QApplication", but the first lines of the main file states:
[code]QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); if (qgetenv("QT_FONT_DPI").isEmpty()) { // Prompted to change the way of checking this qputenv("QT_FONT_DPI", "84"); } QApplication a(argc, argv); qDebug() << "Comenzando"; // This line, never shows qDebug() << QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionString(); QString debug; if (QSslSocket::supportsSsl() ) debug = "Soporta SSL"; else debug = "No soporta SSL"; debug+= " version SSL:" + QSslSocket::sslLibraryVersionString() + " ->" + QSslSocket::sslLibraryBuildVersionString(); (...)
[/code]
Am I missing something?
-
@jsulm
I do have a class named Utilidades (.h/cpp) which does have static methods, although its not included yet (not in main.cpp), and to that matter I also share an instance of a class which is not static nor has any members static, which is not yet used in main nor included.. -
Start your app with QT_FATAL_WARNINGS in a debugger to see where you create a static QWidget before instantiating QApplication
-
Start your app with QT_FATAL_WARNINGS in a debugger to see where you create a static QWidget before instantiating QApplication
@Christian-Ehrlicher
Maybe I'm doing something wrong?
Added:[code] set(QT_FATAL_WARNINGS) [/code]
To CMakeList, ran cmake, ran build, no different output
-
@Christian-Ehrlicher
Maybe I'm doing something wrong?
Added:[code] set(QT_FATAL_WARNINGS) [/code]
To CMakeList, ran cmake, ran build, no different output
@linuxkid said in Problems migrating from 5.14.2 tp Qt 6.8.0:
To CMakeList, ran cmake, ran build, no different output
QT_FATAL_WARNINGS is an environment variable...
-
@linuxkid said in Problems migrating from 5.14.2 tp Qt 6.8.0:
To CMakeList, ran cmake, ran build, no different output
QT_FATAL_WARNINGS is an environment variable...
Well, it seems it is caused by an exception after all:
[quote]
Exception Triggered
<p>The inferior stopped because it triggered an exception.<p>Stopped in thread 0 by:
Exception at 0x7ff82a356718, code: 0xc0000409: , flags=0x1 (execution cannot be continued).
OK
[/quote]
Could this have to do with my copy of libcrypto-1.1-x64.dll not being on the same compiler or abi compatible with msvc2022?
-
I don't know - this does not relate to your initial problem.
-
Sorry, I'm kind of at a loss.
This code built and work with qt 5.14.2, on this files on particular no changes have been made.Should I pastebin both CMakeLists and main.cpp? Launching the debugger does tell me:
QWidget: Cannot create a QWidget without QApplication
Debug Error!Program: C:\Qt\6.8.0\msvc2022_64\bin\Qt6Cored.dll
Module: 6.8.0
File: C:\Users\qt\work\qt\qtbase\src\widgets\kernel\qwidget.cpp
Line: 947QWidget: Cannot create a QWidget without QApplication
-
Sorry, I'm kind of at a loss.
This code built and work with qt 5.14.2, on this files on particular no changes have been made.Should I pastebin both CMakeLists and main.cpp? Launching the debugger does tell me:
QWidget: Cannot create a QWidget without QApplication
Debug Error!Program: C:\Qt\6.8.0\msvc2022_64\bin\Qt6Cored.dll
Module: 6.8.0
File: C:\Users\qt\work\qt\qtbase\src\widgets\kernel\qwidget.cpp
Line: 947QWidget: Cannot create a QWidget without QApplication
@linuxkid said in Problems migrating from 5.14.2 tp Qt 6.8.0:
Launching the debugger does tell me:
And now learn how to use a debugger and look into the stack trace from where it is coming.
"If the QT_FATAL_WARNINGS environment variable is set, qWarning() exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger."
Not that all is properly written down in the documentation...
-
@linuxkid said in Problems migrating from 5.14.2 tp Qt 6.8.0:
Launching the debugger does tell me:
And now learn how to use a debugger and look into the stack trace from where it is coming.
"If the QT_FATAL_WARNINGS environment variable is set, qWarning() exits after printing the warning message. This makes it easy to obtain a backtrace in the debugger."
Not that all is properly written down in the documentation...
@Christian-Ehrlicher Hey man, thanks for the pointings, and unluckily (even if fixed) I do not understand why it was happening (which troubles me more, perhaps its undefined behaviour).
I only moved the shared object from one line to the top of the declarations, as part of an effort to tidy up the place, and that seemed to have done it.
The debugger was pointing to the instance not being alocated/initialized before being used on the main window, instead of the main file.
Maybe I do need to keep an eye at it and fix it more definetly, but since time was running short, I left it to "tech debt" for the future.
Thanks for the time spent though, next time beers are on me!
-