Fix build with MSVC 2005.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 8 May 2011 06:39:31 +0000 (07:39 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 8 May 2011 06:39:31 +0000 (07:39 +0100)
Thanks to horte for pointing this out on geeks3d comment.

CMakeLists.txt
os_win32.cpp

index 4594580..4648879 100755 (executable)
@@ -40,6 +40,9 @@ endif (NOT WIN32)
 if (WIN32)
     # MSVC & MinGW only define & use APIENTRY
     add_definitions (-DGLAPIENTRY=__stdcall)
+
+    # http://msdn.microsoft.com/en-us/library/aa383745.aspx
+    add_definitions (-D_WIN32_WINNT=0x0500 -DWINVER=0x0500)
 else (WIN32)
     CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" CXX_COMPILER_FLAG_VISIBILITY)
     if (CXX_COMPILER_FLAG_VISIBILITY)
index 6cddc55..f220ae5 100644 (file)
@@ -99,11 +99,18 @@ DebugMessage(const char *format, ...)
     va_end(ap);
 
     OutputDebugStringA(buf);
+
+    /*
+     * Also write the message to stderr, when a debugger is not present (to
+     * avoid duplicate messages in command line debuggers).
+     */
+#if _WIN32_WINNT > 0x0400
     if (!IsDebuggerPresent()) {
         fflush(stdout);
         fputs(buf, stderr);
         fflush(stderr);
     }
+#endif
 }
 
 long long GetTime(void)