Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

Problem with std::cout and ofLog when using QT [SOLVED]

$
0
0

@Christof wrote:

Hi,

this is kind of similar to this 6 year old thread https://forum.openframeworks.cc/t/run-an-openframeworks-app-from-a-terminal-and-no-cout-lt-lt/2344.

I've been using oF v0.8.4 with Code::Blocks on Win7 and I had no problem writing:
std::cout << "foo\n";
and getting immediate output.

Now that I've switched to oF v0.9.3 with QT, this won't show anything in the console (QT creator's Application Ouput) until I close the program - unless I flush the buffer with either endl or std::cout.flush();
This is not the case when I write a plain c++ console app (without oF), only for oF apps.

To make things more complicated:
ofLog() doesn't flush the buffer either! So I have to write
ofLog(OF_LOG_NOTICE, "foo");
std::cout.flush();

to make it work.

However,
'ofLogNotice() << "foo";'
works!

Also, if I check "run in terminal" in QT creator's project settings, I don't get any output, neither in the terminal, nor in the Application Output window, even when I flush the buffer.

For plain c++ console apps, cout is definitely unbuffered and output is printed to the terminal and not to Application Output. Anyone knowing more about cout and ofLog behaviour with recent QT?

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles