diff --git a/CMakeLists.txt b/CMakeLists.txt index 8553b636..ba97eca4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -483,6 +483,7 @@ endif() if (MINGW) set(LWS_MINGW_SUPPORT 1) set(CMAKE_C_FLAGS "-D__USE_MINGW_ANSI_STDIO ${CMAKE_C_FLAGS}") + add_definitions(-DWINVER=0x0601 -D_WIN32_WINNT=0x0601) endif() if (LWS_SSL_SERVER_WITH_ECDH_CERT) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 1b980dc1..ea555ab7 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -27,6 +27,7 @@ #ifdef LWS_WITH_IPV6 #if defined(WIN32) || defined(_WIN32) +#include #include #else #include diff --git a/test-apps/test-server.h b/test-apps/test-server.h index 29e67177..892f1e01 100644 --- a/test-apps/test-server.h +++ b/test-apps/test-server.h @@ -19,8 +19,14 @@ */ #if defined(_WIN32) && defined(EXTERNAL_POLL) + +#if (WINVER < 0x0600) +#undef WINVER +#undef _WIN32_WINNT #define WINVER 0x0600 -#define _WIN32_WINNT 0x0600 +#define _WIN32_WINNT WINVER +#endif + #define poll(fdArray, fds, timeout) WSAPoll((LPWSAPOLLFD)(fdArray), (ULONG)(fds), (INT)(timeout)) #endif