2013-03-07 266 views
2

當我在QtCreator中運行控制檯應用程序時,通過xterm(我的操作系統是debian)完成輸出(和input-std :: cout,std :: cin)。我怎樣才能讓輸出顯示在QtCreator的輸出窗格而不是在xterm窗口中?QtCreator std :: cout和輸出窗格

回答

0

您應該爲此使用QDebug()函數。它的用法與std :: cout非常相似。 請看下面的例子:

float coordinate = 3.41; 
qDebug() << "Custom coordinate type:" << coordinate; 

這將輸出,在QtCreator的輸出窗格:

自定義座標類型:3.41

不要忘了包括這一說法,在您的包含區塊中:

#include <QDebug>

欲瞭解更多信息,請查看此鏈接:http://doc.qt.io/qt-5/qdebug.html