Skip to content

Commit f7e4703

Browse files
committed
Win32: Open a console in debug mode to display stderr debug messages.
1 parent 619d6bd commit f7e4703

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/platform/guiwin.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,16 @@ std::vector<std::string> InitGui(int argc, char **argv) {
17011701
SetLocale("en_US");
17021702
}
17031703

1704+
#ifndef NDEBUG
1705+
// create a debug console
1706+
if(AllocConsole()) {
1707+
(void)freopen("CONOUT$", "w", /*stdout*/stderr);
1708+
SetConsoleTitle(L"Debug Console");
1709+
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
1710+
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
1711+
}
1712+
#endif
1713+
17041714
return args;
17051715
}
17061716

0 commit comments

Comments
 (0)