PDA

View Full Version : Thread Problems (i think)



LMZ
28th September 2007, 15:18
I can't understand why "Cout Test" did not printing. I think this is thread problem.

wysota
28th September 2007, 15:41
But you application doesn't use threads... Does the application output anything at all for you?

LMZ
28th September 2007, 15:47
But you application doesn't use threads... Does the application output anything at all for you?
i think signals and slots are using threads.
app output only via qDebug() or cerr.

wysota
28th September 2007, 15:54
i think signals and slots are using threads.
No, they are not.


app output only via qDebug() or cerr.
What operating system are you using?

LMZ
28th September 2007, 16:04
Ubuntu 7.04 Feisty
does this matter?

wysota
28th September 2007, 17:47
Does this output anything?


#include <iostream>
int main(int argc, char **argv){
std::cout << "TESTING" << std::endl;
}
Compile it using qmake please, just like you would for a regular Qt app.

LMZ
28th September 2007, 19:50
yeap! output TESTING =))

jpn
28th September 2007, 19:51
Seems to be missing std::endl.

LMZ
29th September 2007, 11:54
Seems to be missing std::endl.
std::endl is not obligatory at all

marcel
29th September 2007, 12:06
cout works only on stdout, so you need to tell qmake this is a console app.
Therefore add CONFIG += debug console to the pro file.

In a GUI app you can try to output something to cerr. It might work.

wysota
29th September 2007, 12:33
std::endl is not obligatory at all

But lack of it prevents the output buffer from being flushed. Try adding it like J-P suggested.



cout works only on stdout, so you need to tell qmake this is a console app.
Therefore add CONFIG += debug console to the pro file.

In a GUI app you can try to output something to cerr. It might work.

He's using Linux, so that's not the case here. That is why I asked about the OS he uses.

LMZ
29th September 2007, 12:54
Seems to be missing std::endl.

thanks a lot, it works!!!!