【发布时间】:2011-08-23 00:38:59
【问题描述】:
我使用的是 Windows 7 64 位。
我安装了 Eclipse 版本 3.6.2、cdt 和 MinGW。我在 Eclipse 中有一个 C++ 控制台程序,如下所示:
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
setbuf(stdout, NULL);
for (int i = 0; i < 10000000; i++) {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
}
int val;
cin >> val;
return 0;
}
如果我运行这个控制台程序,它应该在 Eclipse 的控制台视图中显示 Hello world,但什么也没有显示。
如果我转到调试文件夹并运行 exe,它会打印到控制台。
如果我犯了一些语法错误,那么 Eclipse 控制台视图会显示一些内容,例如:
**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\hh.o ..\src\hh.cpp
..\src\hh.cpp: In function 'int main()':
..\src\hh.cpp:17:3: error: expected ';' before 'return'
Build error occurred, build is stopped
Time consumed: 255 ms.
为什么 Eclipse 控制台视图中没有显示任何内容?如何让我的 C++ 控制台程序显示输出?
【问题讨论】:
-
是的... 64 位 windows/eclipse/cdt/java/cygwin 没有控制台输出:eclipse.org/forums/…。非常棒,不是吗?
-
我刚刚发现了这一点。现在我需要降级到 32 位 eclipse。 摇头
标签: c++ eclipse console eclipse-cdt