Skip to content

Commit

Permalink
Attach console in debug mode on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
phoerious committed Nov 21, 2020
1 parent 3d10f31 commit c6bd22a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gui/osutils/winutils/WinUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ WinUtils* WinUtils::instance()
{
if (!m_instance) {
m_instance = new WinUtils(qApp);

#ifdef QT_DEBUG
// Attach console to enable debug output
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
#endif
}

return m_instance;
Expand Down

0 comments on commit c6bd22a

Please sign in to comment.