使用Windows和MinGW在Eclipse中编写的C程序无法显示输出到控制台
发布时间:2020-12-13 20:23:59 所属栏目:Windows 来源:网络整理
导读:我正在使用Windows 7 64位. 我安装了eclipse版本3.6.2,cdt和MinGW.我在Eclipse中有一个C控制台程序,如下所示: #include iostream#include cstdiousing namespace std;int main() { setbuf(stdout,NULL); for (int i = 0; i 10000000; i++) { cout "!!!Hello
我正在使用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 Console View会显示一些东西,比如: **** Internal Builder is used for build **** g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrchh.o ..srchh.cpp ..srchh.cpp: In function 'int main()': ..srchh.cpp:17:3: error: expected ';' before 'return' Build error occurred,build is stopped Time consumed: 255 ms. 为什么没有显示在Eclipse控制台视图中,如何使我的C控制台程序显示输出?
我发现这个网站的解决方法:
http://www.eclipse.org/forums/index.php?=42e862594001fa4469bbc834885d545f&t=msg&th=197552 在那个链接中,看看“没有真实姓名”的答复. 如果链接断开,这里是内容: Environment: jdk1.6u18 64bit + Eclipse Helios 64bit + win7 64bit No console output at "Run",but output correctly at "Debug". The following method worked for me: 1. Goto Project->Properties->Run/Debug Settings,choose the .exe file and press "Edit" 2. In the "Environment" tag,press "New",set it as: "Name:PATH" "Value:C:MinGWbin" In fact,I have already set "C:MinGWbin" in windows PATH environment variable,but it seemed to not work. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- UEFI计算机上的Windows和Linux的映像(例如,使用Clonezilla)
- Windows 8升级后,VBA中的Environ(“USERNAME”)返回“User”
- Microsoft Windows中的FIPS“单用户模式”要求
- windows – WinRT和软件ClearType字体渲染
- Windows – 远程桌面服务 – VPN或Web网关?
- windows azure rest api – 创建虚拟机
- 疑难杂症----Windows10
- windows – 批处理脚本解释注释中的内容?
- windows-server-2008 – 所有PHP站点都停止在IIS7上工作,内
- windows – 我应该用什么工具格式化硬盘作为UDF?
推荐文章
站长推荐
- Windows Server 2008中的Set-NetFirewallRule替代
- 如何模拟$window单元测试AngularJS服务?
- 以编程方式在Windows中杀死java进程
- windows – 价格合理的多终端心跳软件
- windows-server-2008 – GPO安全过滤不起作用
- 是否有可能从Windows Server 2016 Nano上的power
- windows-server-2008 – Exchange 2010 DAG自动故
- 通过NTLM从Windows上的Java SE6客户端进行HTTP“
- 使用Coldfusion将事件写入Windows事件日志
- SecureCRT_FX 8.3.3 x86 & x64 (带注册机)下
热点阅读