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. Compilation error with Qt5.15.12 on MacOS - problems with qglobal.h
Forum Update on Monday, May 27th 2025

Compilation error with Qt5.15.12 on MacOS - problems with qglobal.h

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5c++qterrors
1 Posts 1 Posters 469 Views
  • 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.
  • K Offline
    K Offline
    KFlck02
    wrote on last edited by
    #1

    I use Qt5 in combination with the Geant4 software as a visualizer. However, recently after building my project with CMake and C++ 17 standard, I receive the following shortened list of compilation errors (similar to the question posted here https://forum.qt.io/topic/150201/qglobal-h-391-11-error-maybe_unused-attribute-cannot-be-applied-to-types?_=1709828312588&lang=en-GB)

    In file included from /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/QtGlobal:1:
    /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/qglobal.h:399:11: error: 'maybe_unused' attribute cannot be applied to types
    constexpr Q_DECL_UNUSED Deprecated_t Deprecated = {};
              ^
    /opt/homebrew/include/QtCore/qcompilerdetection.h:969:27: note: expanded from macro 'Q_DECL_UNUSED'
    #  define Q_DECL_UNUSED [[maybe_unused]]
                              ^
    In file included from /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/QtGlobal:1:
    /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/qglobal.h:900:50: error: an attribute list cannot appear here
    Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(double p1, double p2)
                                                     ^~~~~~~~~~~~~
    /opt/homebrew/include/QtCore/qcompilerdetection.h:969:25: note: expanded from macro 'Q_DECL_UNUSED'
    #  define Q_DECL_UNUSED [[maybe_unused]]
                            ^~~~~~~~~~~~~~~~
    
    In file included from /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/QtGlobal:1:
    /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/qglobal.h:905:50: error: an attribute list cannot appear here
    Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(float p1, float p2)
                                                     ^~~~~~~~~~~~~
    /opt/homebrew/include/QtCore/qcompilerdetection.h:969:25: note: expanded from macro 'Q_DECL_UNUSED'
    #  define Q_DECL_UNUSED [[maybe_unused]]
                            ^~~~~~~~~~~~~~~~
    
    In file included from /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/QtGlobal:1:
    /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/qglobal.h:910:50: error: an attribute list cannot appear here
    Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNull(double d)
                                                     ^~~~~~~~~~~~~
    /opt/homebrew/include/QtCore/qcompilerdetection.h:969:25: note: expanded from macro 'Q_DECL_UNUSED'
    #  define Q_DECL_UNUSED [[maybe_unused]]
                            ^~~~~~~~~~~~~~~~
    
    In file included from /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/QtGlobal:1:
    /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/qglobal.h:915:50: error: an attribute list cannot appear here
    Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED  bool qFuzzyIsNull(float f)
                                                     ^~~~~~~~~~~~~
    /opt/homebrew/include/QtCore/qcompilerdetection.h:969:25: note: expanded from macro 'Q_DECL_UNUSED'
    #  define Q_DECL_UNUSED [[maybe_unused]]
                            ^~~~~~~~~~~~~~~~
    
    In file included from /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/QtGlobal:1:
    /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/qglobal.h:925:50: error: an attribute list cannot appear here
    Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qIsNull(double d) noexcept
                                                     ^~~~~~~~~~~~~
    /opt/homebrew/include/QtCore/qcompilerdetection.h:969:25: note: expanded from macro 'Q_DECL_UNUSED'
    #  define Q_DECL_UNUSED [[maybe_unused]]
                            ^~~~~~~~~~~~~~~~
    
    In file included from /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/QtGlobal:1:
    /opt/homebrew/Cellar/qt@5/5.15.12_1/lib/QtCore.framework/Headers/qglobal.h:930:50: error: an attribute list cannot appear here
    Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qIsNull(float f) noexcept
                                                     ^~~~~~~~~~~~~
    /opt/homebrew/include/QtCore/qcompilerdetection.h:969:25: note: expanded from macro 'Q_DECL_UNUSED'
    #  define Q_DECL_UNUSED [[maybe_unused]]
    

    I am using Qt5.15.12 as installed from Homebrew on macOS Sonoma 14.3.1 (Xcode 15.2) and using AppleClang 15.0.0 for target arm64-apple-darwin23.3.0.
    This is not an issue I have encountered before so any help would be appreciated.

    1 Reply Last reply
    0

    • Login

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