Fix problem with newer MinGW runtimes
authorSfan5 <sfan5@live.de>
Mon, 14 Apr 2014 16:03:28 +0000 (18:03 +0200)
committerSfan5 <sfan5@live.de>
Mon, 14 Apr 2014 18:09:42 +0000 (20:09 +0200)
src/porting.cpp
src/porting.h

index b0a1843eb0b89d1fa17a8627c917d2eff0948d2e..e7bef1d33f30c5ec3f718180c0a8b073d244ac18 100644 (file)
@@ -23,6 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
        See comments in porting.h
 */
 
+#include "porting.h"
+
 #if defined(__APPLE__)
        #include <mach-o/dyld.h>
        #include "CoreFoundation/CoreFoundation.h"
@@ -37,7 +39,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
        #include <sys/utsname.h>
 #endif
 
-#include "porting.h"
 #include "config.h"
 #include "debug.h"
 #include "filesys.h"
index 9024570bd7dab1635d1439ee4569b131af8575c3..aaabce4eb9c1c9fb4537e600b25ddc81264210b9 100644 (file)
@@ -24,6 +24,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef PORTING_HEADER
 #define PORTING_HEADER
 
+#ifdef _WIN32
+       #ifdef _WIN32_WINNT
+               #undef _WIN32_WINNT
+       #endif
+       #define _WIN32_WINNT 0x0501 // We need to do this before any other headers 
+               // because those might include sdkddkver.h which defines _WIN32_WINNT if not already set
+#endif
+
 #include <string>
 #include "irrlichttypes.h" // u32
 #include "debug.h"
@@ -42,9 +50,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 //#define ALIGNOF(type) offsetof (alignment_trick<type>, member)
 
 #ifdef _WIN32
-       #ifndef _WIN32_WINNT
-               #define _WIN32_WINNT 0x0501
-       #endif
        #include <windows.h>
        
        #define sleep_ms(x) Sleep(x)