From 04be6b2d7a110a61f072488a6ffefe2cf3d0c000 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 2 Jul 2018 10:25:16 +0200 Subject: Enable console output on Win32 --- src/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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 #include +#ifdef _WIN32 +#include +#include +#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 config = std::make_unique(nullptr); #ifdef QT_DEBUG -- cgit v1.2.1