Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problems migrating from 5.14.2 tp Qt 6.8.0
Forum Updated to NodeBB v4.3 + New Features

Problems migrating from 5.14.2 tp Qt 6.8.0

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 3 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L linuxkid

    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?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @linuxkid Do you have any static QObject derived instances?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    L 1 Reply Last reply
    0
    • jsulmJ jsulm

      @linuxkid Do you have any static QObject derived instances?

      L Offline
      L Offline
      linuxkid
      wrote on last edited by
      #3

      @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..

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Start your app with QT_FATAL_WARNINGS in a debugger to see where you create a static QWidget before instantiating QApplication

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        L 1 Reply Last reply
        3
        • Christian EhrlicherC Christian Ehrlicher

          Start your app with QT_FATAL_WARNINGS in a debugger to see where you create a static QWidget before instantiating QApplication

          L Offline
          L Offline
          linuxkid
          wrote on last edited by
          #5

          @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 EhrlicherC 1 Reply Last reply
          0
          • L linuxkid

            @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 EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @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...

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            L 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              @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...

              L Offline
              L Offline
              linuxkid
              wrote on last edited by
              #7

              @Christian-Ehrlicher

              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?

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #8

                I don't know - this does not relate to your initial problem.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  linuxkid
                  wrote on last edited by
                  #9

                  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: 947

                  QWidget: Cannot create a QWidget without QApplication

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • L linuxkid

                    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: 947

                    QWidget: Cannot create a QWidget without QApplication

                    Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @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...

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    L 1 Reply Last reply
                    2
                    • Christian EhrlicherC Christian Ehrlicher

                      @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...

                      L Offline
                      L Offline
                      linuxkid
                      wrote on last edited by
                      #11

                      @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!

                      1 Reply Last reply
                      0
                      • L linuxkid has marked this topic as solved on

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved