From: José Fonseca Date: Sun, 8 May 2011 06:39:31 +0000 (+0100) Subject: Fix build with MSVC 2005. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=eb508e6e2cd54257708aed9b0cbd4bea358fc467;p=apitrace Fix build with MSVC 2005. Thanks to horte for pointing this out on geeks3d comment. --- 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)