Z
Z
ZeroEllipse2015-08-06 17:15:27
Qt
ZeroEllipse, 2015-08-06 17:15:27

What can I do to prevent this from happening - the printf function does not output anything to the C++ console?

1d8c89532c2a48e0a2b511a1c8447c63.jpgWindows XP, QT 5.4.0, minGW

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
MiiNiPaa, 2015-08-06
@MiiNiPaa

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.

D
Dum_spiro_spero, 2015-08-06
@Dum_spiro_spero

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.

M
Mak Alexey, 2015-08-06
@S-ed

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

Create a new project:
File -> New File or Project -> Application -> Qt Console Application
Content main.cppcan be completely replaced.
The compilation process setting is in the tab Projects (Ctrl+5).
In my case:
qmake.exe X:\DEV\Qt\untitled\untitled.pro -r -spec win32-msvc2013

V
Vitaly, 2015-08-07
@Wohlstand

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 question

Ask a Question

731 491 924 answers to any question