From 170663fdc3824699694425c75b10ae30f7b77fcd Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Mon, 7 Jan 2019 11:10:30 +0100 Subject: [PATCH] Fix build with MinGW v6.0.0 Including pthread.h is a workaround for a bug in the MinGW headers, where pthread.h (which defines _POSIX_THREAD_SAFE_FUNCTIONS) has to be included before time.h so that time.h defines localtime_r correctly, wich depends in _POSIX_THREAD_SAFE_FUNCTIONS being defined previously. Compilation error: [...]srt_compat.h:78:9: error: 'localtime_r' was not declared in this scope --- common/win/wintime.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/win/wintime.h b/common/win/wintime.h index d763eaa2d..781bbe563 100644 --- a/common/win/wintime.h +++ b/common/win/wintime.h @@ -3,6 +3,11 @@ #include #include +// HACK: This include is a workaround for a bug in the MinGW headers +// where pthread.h, which defines _POSIX_THREAD_SAFE_FUNCTIONS, +// has to be included before time.h so that time.h defines +// localtime_r correctly +#include #include #ifdef __cplusplus