diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-02 10:25:16 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-02 10:25:16 +0200 |
commit | 04be6b2d7a110a61f072488a6ffefe2cf3d0c000 (patch) | |
tree | 062a53c4420907af4a8e22eea4e3cfa344cc4351 /src | |
parent | Add nullptr profile check to createSession (diff) | |
download | smolbote-04be6b2d7a110a61f072488a6ffefe2cf3d0c000.tar.xz |
Enable console output on Win32
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 870120e..e81c846 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,9 +16,21 @@ #include "session.h" #include <QTranslator> #include <QLibraryInfo> +#ifdef _WIN32 +#include <windows.h> +#include <cstdio> +#endif int main(int argc, char **argv) { + // a beautiful hack to be able to write to stdout on Windows +#ifdef _WIN32 + if (AttachConsole(ATTACH_PARENT_PROCESS)) { + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + } +#endif + // create and load configuration std::unique_ptr<Configuration> config = std::make_unique<Configuration>(nullptr); #ifdef QT_DEBUG |