Search code examples
c++qtc++11type-traits

std type_traits conflict with Qt type_traits


I have Qt 5.8 installed and i get this error. I also have CONFIG += c++14 in my pro file and i also tried with c++11.

/usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:106: error: ‘is_same’ is not a member of ‘QtPrivate’!QtPrivate::is_same<const 

also

/usr/include/c++/5/type_traits:958: note:   ‘std::is_same’
     struct is_same;

Solution

  • I've been doing some digging in the Qt git repository, based on the comment to the question by @DanielJour.

    Looking to the history of file qtimer.h and correlating it to your error message (qtimer.h:106: error: ‘is_same’ is not a member...), I've found that this commit moved the call to is_same from line 106 to 112 (and never came back), so you are including a qtimer.h from before that commit.

    That commit is from 2016-01-15 and it is included from Qt 5.7 onwards.

    So my guess is that you have installed several different versions of Qt and somehow your program is including old headers, not the ones from Qt 5.8.

    An additional note that leads me to that conclusion is that your header file is in /usr/include/x86_64-linux-gnu/qt5/, but the usual place where that is installed is in /usr/include/qt or /usr/include/qt5. Yours looks like a multilib or cross compiler path...