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

GCC 11 requires explicit #include <limits>

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.0.4
    • Fix Version/s: None
    • Component/s: Core: Other
    • Labels:
      None
    • Environment:
      Windows using MinGW-w64 GCC 11 (both for 32-bit and 64-bit Windows) from http://winlibs.com/
    • Platform/s:
      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

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

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes