Answer the question
In order to leave comments, you need to log in
What can I do to prevent this from happening - the printf function does not output anything to the C++ console?
Windows XP, QT 5.4.0, minGW
Answer the question
In order to leave comments, you need to log in
1) Try to get rid of the Russian text in printf first. Output something exclusively in Latin.
2) Try adding fflush(stdout) between printf and getch. I'm not sure if getch flushes the buffer.
Does it run the same file that compiles?
Try deleting the exe.
I'm not a miniGW expert, but I came across something similar in VC++ - compilation is in progress, and a file that has already been linked is launched.
In QtCreator, a project file is required for compilation:
It specifies the files and libraries required for compilation.
QT += core
QT -= gui
TARGET = untitled
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
File -> New File or Project -> Application -> Qt Console ApplicationContent
main.cpp
can be completely replaced. Projects (Ctrl+5)
. qmake.exe X:\DEV\Qt\untitled\untitled.pro -r -spec win32-msvc2013
If you collect the file through g ++ file.cpp -o file.exe, then I think there will be no problems. Although, as mentioned here, try adding fflush(stdout); immediately after all printf(); before getch(); Due to the fact that in my Qt application I redirected the output from qDebug () to a file, then in order to simply print in the debug console, I wrote printf () and then fflush (stdout); otherwise, all messages are displayed only after the application is closed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question