0

I am developing a Qt application on Ubuntu 17.04. I was previously using the latest Qt version (Qt 5.12.2) but I had to go back a few versions to Qt 5.8.

I was able to compile with using Qt 5.12 with no issues but with Qt 5.8 I get the following errors all related to 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

Any ideas on how to resolve this issue.

Is this a g++ version or a libstdc++ version issue?

Here is my g++ version:

$ 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.

If so, if any advice on what to purge/remove and apt-get install would be helpful.

Ankur Shah
  • 125
  • 12
  • Seems that someone is messing with max,min macros. You can try to undef max and min (https://stackoverflow.com/questions/518517/macro-max-requires-2-arguments-but-only-1-given). Can you provide more information about build and libraries included ? – jgoday Mar 26 '19 at 19:15
  • $ strings libstdc++.so.6 | grep LIBCXX GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBCXX_3.4.20 GLIBCXX_3.4.21 GLIBCXX_3.4.22 GLIBCXX_DEBUG_MESSAGE_LENGTH – Ankur Shah Mar 26 '19 at 19:18
  • Sorry about the formatting above...I was just grepping LIBCXX on the library – Ankur Shah Mar 26 '19 at 19:18
  • My issues are much more than max and min. I didn't include it here but it's all throughout the std::chrono file. – Ankur Shah Mar 26 '19 at 19:20
  • You'll have to fix the `min` and `max` macro issue first, and then see what's left over. – Howard Hinnant Mar 26 '19 at 19:25
  • I found the answer in the following post: https://askubuntu.com/questions/724872/downgrade-gcc-from-5-2-1-to-4-9-ubuntu-15-10 – Ankur Shah Mar 26 '19 at 21:25

0 Answers0