From 564ec31c2d05c822b8ee39efecf95eace5751c5c Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 8 Dec 2020 17:02:11 +0100 Subject: [PATCH] Windows: write to console --- src/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 5482d44..a42749e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,6 +14,10 @@ #include +#if defined(Q_OS_WIN) +#include +#endif + #if defined(Q_OS_LINUX) && defined(STATIC) Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) #endif @@ -32,6 +36,13 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(assets_mining); #endif +#ifdef _WIN32 +if (AttachConsole(ATTACH_PARENT_PROCESS)) { + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); +} +#endif + QStringList argv_; for(int i = 0; i != argc; i++){ argv_ << QString::fromStdString(argv[i]);