Menu

#25 Cannot compile anymore with QT5

git_head
open
nobody
None
2023-06-24
2023-06-18
No

I'm using QT-5.9.4 on Windows for compiling QSynth 0.9.11, but I got some errors.
These errors happened because the code is using Q_OS_WINDOWS in some places.
Unfortunately, this macros has been introduced just recentlyin one of the latest QT6, as an alias on Q_OS_WIN:

https://github.com/qt/qtbase/commit/9444416a46ee0e6bb0d9d9be9a4883b388644c59

From the log, you can understand that the Q_OS_WINDOWS macro has been added just for helping people to avoid mistakes when typing code:

As seen in several occasions, both in user code and in Qt proper, people make these mistakes. What makes it harder to spot is that it doesn't look like a typo, and feels natural (natural as Q_OS_LINUX instead of Q_OS_LIN feels).
This is a recurring problem, no matter how much people test and review
these errors will happen, so the alias is justified.

In my opinion, the easier and faster fix would be to just replace all Q_OS_WINDOWS with Q_OS_WIN, which will allow to build QSynth again with QT5 and, afterall, it is the right macro historically used for detecting the Windows platform correctly.

Discussion

  • Rui Nuno Capela

    Rui Nuno Capela - 2023-06-19

    Q_OS_WINDOWS appears to have been introduced in Qt 5.12
    https://doc.qt.io/archives/qt-5.12/qtglobal.html

    you better upgrade your Qt installation - v5.9 is way too old and long unsupported; consider to upgrade to 5.15 or better yet, to 6.5 LTS.

    if not, then consider to substitute all occurrences of Q_OS_WINDOWS with Q_OS_WINin the code; or add these lines to src/config.h.cmake:

    #if defined(Q_OS_WIN)
    #define Q_OS_WINDOWS Q_OS_WIN
    #endif
    
     
  • Carlo Bramini

    Carlo Bramini - 2023-06-24

    Thank you for the reply.
    Replacing all Q_OS_WINDOWS with Q_OS_WIN already fixed the issue on my build.
    I understand that Qt 5.9 branch is old, but I would like to say that nothing else needed to be changed besides using Q_OS_WIN instead of Q_OS_WINDOWS.
    Unfortunately, CYGWIN is shipped with Qt-5.9.4, which makes one of the above fixes the only solution.
    However, I can also provide a patch into my QSynth source package forCYGWIN, for making the build process possible.

     

Log in to post a comment.