Skip to content

Commit

Permalink
Win32: Open a console in debug mode to display stderr debug messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruevs committed Jun 26, 2024
1 parent 2afabad commit f9e374f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/platform/guiwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,16 @@ std::vector<std::string> InitGui(int argc, char **argv) {
SetLocale("en_US");
}

#ifndef NDEBUG
// create a debug console
if(AllocConsole()) {
(void)freopen("CONOUT$", "w", /*stdout*/stderr);
SetConsoleTitle(L"Debug Console");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
}
#endif

return args;
}

Expand Down

0 comments on commit f9e374f

Please sign in to comment.