Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-93452

GCC 11 requires explicit #include <limits>

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.0.4
    • Core: Other
    • None
    • Windows using MinGW-w64 GCC 11 (both for 32-bit and 64-bit Windows) from http://winlibs.com/
    • All

    Description

      When building both Qt5 and Qt6 with GCC 11 (in my case on Windows using MinGW-w64 GCC 11 from http://winlibs.com/) there are multiple errors reporting that std::numeric_limits does not exist.

      As explained on https://gcc.gnu.org/gcc-11/porting_to.html there are some headers (including <limits>) that need to be explicitly included since GCC 11.

      For me the wollowing solution works to build both Qt5 ant Qt6 with GCC 11: I add these 3 lines at the top of qtbase/src/corelib/global/qglobal.h :
      #ifdef __cplusplus
      #include <limits>
      #endif

       

      Probably my solution is a bit general, but it does the trick for now.
      A cleaner solution might be to add #include <limits> only where it's needed.

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thiago Thiago Macieira
              brechtsanders Brecht Sanders
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes