From eb508e6e2cd54257708aed9b0cbd4bea358fc467 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 8 May 2011 07:39:31 +0100 Subject: [PATCH] Fix build with MSVC 2005. Thanks to horte for pointing this out on geeks3d comment. --- CMakeLists.txt | 3 +++ os_win32.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4594580..4648879 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/os_win32.cpp b/os_win32.cpp index 6cddc55..f220ae5 100644 --- a/os_win32.cpp +++ b/os_win32.cpp @@ -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) -- 2.45.2