0

我正在 Ubuntu 17.04 上开发 Qt 应用程序。我以前使用的是最新的 Qt 版本(Qt 5.12.2),但我不得不将几个版本返回到 Qt 5.8。

我能够使用 Qt 5.12 毫无问题地进行编译,但是使用 Qt 5.8 我得到以下所有与 std::chrono 相关的错误:

In file included from /opt/Qt5.8.0/5.8/gcc_64/include/QtCore>/qmutex.h:48:0,
                 from /opt/Qt5.8.0/5.8/gcc_64/include/QtCore/QMutex:1,
                 ...

/usr/include/c++/6/chrono:221:6: error: macro "max" requires 2 arguments, but only 1 given
  max()
      ^
                                     ^
/usr/include/c++/6/chrono:225:6: error: macro "min" requires 2 arguments, but only 1 given
  min()
      ^
    ^~~~~~
/usr/include/c++/6/chrono:222:4: error: expected ‘}’ before ‘return’
/usr/include/c++/6/chrono:222:4: error: function definition does not declare parameters
/usr/include/c++/6/chrono:224:2: error: a storage class can only be specified for objects and functions
  static constexpr _Rep
  ^~~~~~
/usr/include/c++/6/chrono:224:19: error: expected ‘;’ before ‘_Rep’
  static constexpr _Rep
                   ^~~~
etc

有关如何解决此问题的任何想法。

这是 g++ 版本还是 libstdc++ 版本问题?

这是我的 g++ 版本:

$ g++ --version
g++ (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

如果是这样,如果有任何关于清除/删除和 apt-get install 的建议会有所帮助。

4

0 回答 0