From 16b67644b0a6762870d0670371c5e5085a441337 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 9 Mar 2023 08:13:20 +0200 Subject: [PATCH] freopen_s() is not available for mingw. --- src/libs/vmisc/vabstractapplication.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index 2abfe8808..7267b78db 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -262,9 +262,14 @@ void VAbstractApplication::WinAttachConsole() auto stdout_type = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)); if (stdout_type == FILE_TYPE_UNKNOWN && AttachConsole(ATTACH_PARENT_PROCESS)) { +#ifdef Q_CC_MSVC FILE *fp = nullptr; freopen_s(&fp, "CONOUT$", "w", stdout); freopen_s(&fp, "CONOUT$", "w", stderr); +#else + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); +#endif // Q_CC_MSVC } } #endif