我正在尝试开发环境,以确保一切正常并且我的代码可以正常编译,并且如果我在QT Creator中运行它,我会在命令日志窗口中看到输出,但是看不到任何输出实际的命令提示符本身。我可以重定向输出(参见图片),它将在文本文件中列出,但在控制台上什么也没有。我已经尝试过QTextSteam和标准cout。
// #include <QTextStream>
#include <iostream>
using namespace std;
int main() {
//QTextStream(stdout) << "Hello, world!" << endl;
cout << "Hello, world!" << endl;
cout << "Hello, world!" << endl;
cout << "Hello, world!" << endl;
//cout.flush();
return 0;
}
输出:
C:\Users\user\Documents\dev\hello\release>hello.exe
C:\Users\user\Documents\dev\hello\release>hello > test.txt
C:\Users\user\Documents\dev\hello\release>type test.txt
Hello, world!
Hello, world!
Hello, world!