Qt standard output. cout does no print

Stefano picture Stefano · Sep 27, 2011 · Viewed 17.8k times · Source

I saw this question already on this forum but i do not know why the proposed answer does not work in my case. So I try to ask for other slution.

I'm a complete newby in c++ Qt programming. I just got my Qt crator running under linux.

i do not understand why my:

cout << "This does not appear";

does not print in console while qdebug does

qDebug() << "This appears";

this is what is contained in my .pro file:

QT       += core gui

TARGET = aaa
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp \
    IeplcModule.cpp

HEADERS  += mainwindow.h \
    IeplcModule.h

FORMS    += mainwindow.ui

#enable console
CONFIG += console

Any idea?

Cheers,

Stefano

Answer

robermorales picture robermorales · Sep 27, 2011

Try with cout << "asdf" << endl;

Possibly Qt sets up iostream in order to flush only at new line.