Qt 6 incompatible with Clang?
-
Compiling with Clang 14, which is a C++20 compiler, I am getting strange errors, below.
It there a flag I need to set to change Clang's compatibility?In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/QMainWindow:1: In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qmainwindow.h:7: In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qtwidgetsglobal.h:7: In file included from /usr/include/x86_64-linux-gnu/qt6/QtGui/qtguiglobal.h:7: /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:106:6: error: "Qt requires a C++17 compiler" # error "Qt requires a C++17 compiler" ^ /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:491:11: warning: inline variables are a C++17 extension [-Wc++17-extensions] constexpr inline Deprecated_t Deprecated = {}; ^ /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:1009:43: error: no template named 'is_arithmetic_v' in namespace 'std'; did you mean 'is_arithmetic'? typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> && ~~~~~^~~~~~~~~~~~~~~ is_arithmetic /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:585:12: note: 'is_arithmetic' declared here struct is_arithmetic
-
@whatabout Then make sure to enable c++17 as I already wrote.
@Christian-Ehrlicher
Yes, it turns out the fix is simple:clang -std=c++17
-
Compiling with Clang 14, which is a C++20 compiler, I am getting strange errors, below.
It there a flag I need to set to change Clang's compatibility?In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/QMainWindow:1: In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qmainwindow.h:7: In file included from /usr/include/x86_64-linux-gnu/qt6/QtWidgets/qtwidgetsglobal.h:7: In file included from /usr/include/x86_64-linux-gnu/qt6/QtGui/qtguiglobal.h:7: /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:106:6: error: "Qt requires a C++17 compiler" # error "Qt requires a C++17 compiler" ^ /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:491:11: warning: inline variables are a C++17 extension [-Wc++17-extensions] constexpr inline Deprecated_t Deprecated = {}; ^ /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:1009:43: error: no template named 'is_arithmetic_v' in namespace 'std'; did you mean 'is_arithmetic'? typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> && ~~~~~^~~~~~~~~~~~~~~ is_arithmetic /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:585:12: note: 'is_arithmetic' declared here struct is_arithmetic
Please show your pro-file / CMakeLists.txt and make sure you've enabled c++17 support.
-
Please show your pro-file / CMakeLists.txt and make sure you've enabled c++17 support.
@Christian-Ehrlicher I'm not using either a .pro file or a cmake file. I'm just using a regular Makefile and I'm not specifying any particular C++ compatibility. In my situation I can't use either qmake or cmake. So for instance, I am running moc myself.
-
@Christian-Ehrlicher I'm not using either a .pro file or a cmake file. I'm just using a regular Makefile and I'm not specifying any particular C++ compatibility. In my situation I can't use either qmake or cmake. So for instance, I am running moc myself.
@whatabout Then make sure to enable c++17 as I already wrote.
-
@whatabout Then make sure to enable c++17 as I already wrote.
@Christian-Ehrlicher
Yes, it turns out the fix is simple:clang -std=c++17
-