Attach console in debug mode on Windows

This commit is contained in:
Janek Bevendorff 2020-11-21 01:03:23 +01:00
parent 3d10f31211
commit c6bd22aa12

View File

@ -30,6 +30,14 @@ WinUtils* WinUtils::instance()
{ {
if (!m_instance) { if (!m_instance) {
m_instance = new WinUtils(qApp); 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; return m_instance;