2013-03-07 37 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