From 684c9b82b9b8216f406c59deb35cd727ffb6d69b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 28 Sep 2021 17:10:11 -0700 Subject: [PATCH] QDateTime: fix build with MinGW: need unistd.h very early qobject.h has #include , which #includes , which includes . datetime.cpp:2621:23: error: 'localtime_r' was not declared in this scope; did you mean 'localtime_s'? Pick-to: 6.2 Change-Id: I2bbf422288924c198645fffd16a922719c4ce7d4 Reviewed-by: Edward Welbourne --- mkspecs/win32-g++/qplatformdefs.h | 2 ++ src/corelib/time/qdatetime.cpp | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mkspecs/win32-g++/qplatformdefs.h b/mkspecs/win32-g++/qplatformdefs.h index c5a70b1445e..e9ced3732ad 100644 --- a/mkspecs/win32-g++/qplatformdefs.h +++ b/mkspecs/win32-g++/qplatformdefs.h @@ -46,6 +46,8 @@ #endif #endif +#include // Defines _POSIX_THREAD_SAFE_FUNCTIONS and others + // Get Qt defines/settings #include "qglobal.h" diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 7ee38656112..ab3d923ef96 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -66,9 +66,6 @@ # include #endif #include -#ifdef Q_CC_MINGW -# include // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r() -#endif QT_BEGIN_NAMESPACE