我安装了 Qt 5.8,但出现此错误。 我的 pro 文件中也有 CONFIG += c++14,我也尝试过使用 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
还有
/usr/include/c++/5/type_traits:958: note: ‘std::is_same’
struct is_same;
最佳答案
根据@DanielJour 对问题的评论,我一直在 Qt git 存储库中进行一些挖掘。
查看文件 qtimer.h
的历史并将其与您的错误消息相关联(qtimer.h:106: error: 'is_same' is not a member...
),我发现 this commit将对 is_same
的调用从第 106 行移动到第 112 行(并且再也没有回来),因此您在 提交之前包含了一个 qtimer.h
.
该提交是从 2016-01-15 开始的,它包含在 Qt 5.7 之后。
所以我的猜测是您已经安装了几个不同版本的 Qt,并且您的程序以某种方式包含旧的 header ,而不是来自 Qt 5.8 的 header 。
导致我得出该结论的附加说明是您的头文件位于 /usr/include/x86_64-linux-gnu/qt5/
中,但通常安装它的位置是/usr/include/qt
或 /usr/include/qt5
。你的看起来像一个 multilib 或交叉编译器路径......
关于c++ - std type_traits 与 Qt type_traits 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43157738/