Can I see the program exit in Qt-Creator?

I am writing a simple OpenGL program with Qt Creator, which basically creates a QGLWidget, shows it and starts the application loop. I usually like to debug more diagnostic messages turned on and off by preprocessor symbols that use the actual debugger and clock, etc. In Qt Creator, we have the Application Output tab, but all I see is "Running xxx.exe. Xxx.exe completed with code 0". There is no way out of std::cout or std::cerr . Now I know that I can run the application from cmd.exe (yes, I use Windows, I love it: P) and I see the output there, but I would like to see the result directly from the IDE. Is it possible? Thanks

+7
c ++ qt qt-creator
source share
4 answers

Typically, the Application Output panel works fine. Are you sure you will see the result from cmd.exe (did you really try?)? It is usually disabled for user interface applications to avoid console windows. Try CONFIG += console . Also check if you see qDebug () messages in the application output.

+8
source share

just #include <QDebug> and then use qDebug instead of cout , for example

 qDebug() << "you just clicked ok"; 

also it works

 #include <QTextStream> QTextStream out(stdout); out << "\nHello World!\n"; 

adding CONFIG += console to the .pro file did not help me. I wonder why?

I just discovered that I have to add "endl;" for cout work like

 cout << "print this" << endl; 
+5
source share

Alternatively, you can check the "run console" setting in the Project-> Run options. This will open a new console window and display all console output (if using CONFIG += console ).

+3
source share

Try: Tools β†’ Options On the General tab of the Environment section, change the terminal entry using

  x-terminal-emulator -e 

to

  xterm -e 
0
source share

All Articles