From 65c761345f30c44c1f9e36112da8906d2661dd4c Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sun, 16 Sep 2018 00:04:47 +0200 Subject: [PATCH] fix: MSVC defines _DEBUG, not DEBUG --- src/gfx2.rc | 2 +- src/gfx2log.c | 7 +++++-- src/main.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gfx2.rc b/src/gfx2.rc index e1976ed3..42975207 100644 --- a/src/gfx2.rc +++ b/src/gfx2.rc @@ -8,7 +8,7 @@ FILEVERSION 2,6,0,2100 PRODUCTVERSION 2,6,0,2100 FILEFLAGSMASK VS_FF_DEBUG -#ifdef DEBUG +#ifdef _DEBUG FILEFLAGS VS_FF_DEBUG #else FILEFLAGS 0 diff --git a/src/gfx2log.c b/src/gfx2log.c index a95221d6..f5be9857 100644 --- a/src/gfx2log.c +++ b/src/gfx2log.c @@ -19,6 +19,9 @@ along with Grafx2; if not, see */ +#if defined(_MSC_VER) +#include +#endif #if defined(USE_SDL2) #include #endif @@ -34,7 +37,7 @@ extern void GFX2_Log(GFX2_Log_priority_T priority, const char * fmt, ...) va_start(ap, fmt); GFX2_LogV(priority, fmt, ap); va_end(ap); -#if defined(_MSC_VER) && defined(DEBUG) +#if defined(_MSC_VER) && defined(_DEBUG) { char message[1024]; va_start(ap, fmt); @@ -47,7 +50,7 @@ extern void GFX2_Log(GFX2_Log_priority_T priority, const char * fmt, ...) extern void GFX2_LogV(GFX2_Log_priority_T priority, const char * fmt, va_list ap) { -#if !defined(DEBUG) +#if !defined(_DEBUG) if ((unsigned)GFX2_verbosity_level < (unsigned)priority) return; #endif diff --git a/src/main.c b/src/main.c index b102cbca..e72844c3 100644 --- a/src/main.c +++ b/src/main.c @@ -211,7 +211,7 @@ void Error_function(int error_code, const char *filename, int line_number, const snprintf(msg_buffer, sizeof(msg_buffer), "Error number %d occured in file %s, line %d, function %s.\n", error_code, filename,line_number,function_name); fputs(msg_buffer, stderr); -#if defined(_MSC_VER) && defined(DEBUG) +#if defined(_MSC_VER) && defined(_DEBUG) OutputDebugStringA(msg_buffer); #endif @@ -277,7 +277,7 @@ void Error_function(int error_code, const char *filename, int line_number, const { fputs(msg, stderr); #if defined(WIN32) -#if defined(DEBUG) +#if defined(_DEBUG) OutputDebugStringA(msg); #endif MessageBoxA(GFX2_Get_Window_Handle(), msg, "GrafX2 error", MB_OK | MB_ICONERROR);