Windows: write to console

This commit is contained in:
tobtoht 2020-12-08 17:02:11 +01:00
parent 0f96dd7fb5
commit 564ec31c2d
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C

View file

@ -14,6 +14,10 @@
#include <QtPlugin>
#if defined(Q_OS_WIN)
#include <windows.h>
#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]);