"enable_if_t" has no member "type"
-
Hello there,
I'm completely new to Qt. Just downloaded the Qt6 and try to play with the examples.
The OS is Ubuntu 20.04 LTS and the Qt version is 6.1.0.
Every time I tried to compile the project I got the following error message:
/usr/include/c++/9/type_traits:2385: error: class "std::enable_if<false, void>" has no member "type"
using enable_if_t = typename enable_if<_Cond, _Tp>::type;
detected during:
instantiation of type "std::enable_if_t<false, void>" at line 271 of "~/Qt/6.1.0/gcc_64/include/QtCore/qlist.h"
instantiation of class "QList<T> [with T=uint={unsigned int}]" at line 939 of "~/Qt/6.1.0/gcc_64/include/QtCore/qlist.h"Can anyone please help me out here?
Many thx.
-
Hi, welcome to the forum.
The
::type
helper was added in C++14 so it seems you're running your compiler in C++11 mode.
Qt 6 requires C++17, so you need to make sure you're using that version of the standard:CONFIG += c++17
in the .pro file if you're using qmake. -
@Chris-Kawa said in "enable_if_t" has no member "type":
CONFIG += c++17 in the .pro file if you're using qmake.
And if you are using CMake
set_target_properties(MyApplication PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON )
-
Thank you guys. Problem solved. Added the flag as Chris suggested. It turns out I was also using icpc as my default compiler and that was also giving my trouble.