Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Modules appear to be missing from builds



  • Hello everyone,

    Currently having an issue building one of my projects that I haven't opened since December 2019.

    When building I get error messages like the following

    #include <QtGlobal>

     Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
                ^~~~~~~~~~~~~~~~~~~~
                Q_DECL_CONST_FUNCTION
    

    #include <QDebug>

         inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); }
                                   ^~~~~~~~~~~
    
         inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); }
                                ^~
    
         inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); }
                                               ^
    

    These errors are caused by the import of qt modules such as #include <QtGlobal> in my header file. Previously this worked no problem but now to fix this issue I have to use #include <QtCore/QtGlobal>

    This also occurs with other QtCore includes such as <QObject> and <QDebug>, both of which never used to need to be prefixed with QtCore. The issue also affects <QtGui> imports too.

    My .pro file contains the following

    QMAKE_CXXFLAGS +=-Wa,-mbig-obj
    QT += gui
    QT += widgets
    QT += qml
    QT += quick
    QT += quickcontrols2
    CONFIG += \
        c++11 \
        object_parallel_to_source \
        enable_openssl \
        thread \
        no_include_pwd \
        no_keywords\
        static_and_shared
    
    • Version: 5.12.2 (tested 5.14.1 with the same result)

    • Both Qt creator and qmake/make end up with the same result

    • Creating a project from scratch does not experience this issue and compiles fine.

    Replacing the imports with full path i.e <QtCore/QDebug> ends up resulting in a heap of errors the same as below.

    C:\Users\***\Documents\QT\QML_Wallet\depends\x86_64-w64-mingw32\include\QtCore\qglobal.h:84: error: division by zero in #if
     #define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
                                  ^
    

    If anyone has any solutions to fix this error, please let me know it's doing my head in.

    Thanks



  • @AltFreq

    Hi and welcome to devnet forum

    Since December 2019 is not too long ago, did this run already Qt5.12.2?

    If no, try first the Qt version which you used for sure in december 2019?

    If yes, the question is what has changed in between?

    When you switch build chains, did you make sure that you rerun qmake?



  • @koahnig, Thanks for the reply.

    This version did run previously on 5.12.2 which is why I tried rolling it back from 5.14.
    Qmake has been run each time since.
    Changes would include a fresh install of Qt.
    Recompiling of my 3rd party libraries (using the same Mingw64 provided by Qt).

    I think I may have just found the error. My depends folder now contains a version of Qt which it appears to be pulling specific files from due to LIB imports and INCLUDE.

    When I open the qglobal.h file it takes me to a file within my build directory rather than the Qt src. I'll check this out and report back.



  • Ok looks like I was correct with my last post. I forgot that I had Qt binaries in my dependency folder which was for an older version of QT. Qt was trying to build with both new and old versions of module files depending on how included them in the header
    Thanks for your help.


Log in to reply