From 235654697f4ec1a4bdd83ff4328f677790cb1683 Mon Sep 17 00:00:00 2001 From: Jose Santiago Date: Thu, 15 Apr 2021 12:53:02 -0500 Subject: [PATCH] MINGW Build Fix. There is a macro that redefines claose to closesocket, but then close is later defined in unistd.h which is included in testutil_unity.cpp which then causes the regular close() prototype to be defined with the new function name closesocket which does not match the signature of the original closesocket in winsock2.h from the toolchain. We can work around this issue, by making sure that unistd.h is included before the macro is defined. HMM> Yes macro substitution is the root of evil. --- tests/testutil.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/testutil.hpp b/tests/testutil.hpp index c6f5e4de..09b9fa77 100644 --- a/tests/testutil.hpp +++ b/tests/testutil.hpp @@ -41,6 +41,9 @@ // For AF_INET and IPPROTO_TCP #if defined _WIN32 #include "../src/windows.hpp" +#if defined(__MINGW32__) +#include +#endif #else #include #include