Compilation error with Qt5.15.12 on MacOS - problems with qglobal.h
Unsolved
General and Desktop
-
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.