[英]c++ files compile with mingw doesn't print hello world
I am trying to compile c++ files with mingw and eclipse, C programs compile and print , my problem is with c++, I added paths to all the needed files and especially to: 我正在尝试使用mingw和eclipse编译c ++文件, C程序进行编译和打印 ,我的问题是c ++,我为所有需要的文件添加了路径,尤其是:
C:\MinGW\lib\gcc\mingw32\4.8.1\include\c++
where the iostream
file is located. iostream
文件所在的位置。
The program compiles just fine and runs but it doesnt print the "!!!Hello World!!!"
该程序可以正常编译并运行,但不会打印
"!!!Hello World!!!"
message. 信息。 The code is the ordinary hello world example.
该代码是普通的hello world示例。
I tried all the includes I could find but nothing seem to help. 我尝试了所有包含的内容,但似乎无济于事。
Any suggestions? 有什么建议么?
The code: 编码:
#include <iostream>
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
EDIT: in my case the answer was found in Eclipse CDT using MinGW does not output in console 编辑:在我的情况下, 使用MinGW在Eclipse CDT中找到的答案未在控制台中输出
From this line C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include\\c++
it seems you are using the 32 bit version of the compiler. 从这一行
C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include\\c++
,看来您正在使用32位版本的编译器。 There are issues with Eclipse CDT and C++ compiler when their architectures mismatch. 当它们的体系结构不匹配时,Eclipse CDT和C ++编译器存在问题。 Please see which architecture of Java, JDK, Eclipse CDT are you using.
请查看您使用的Java,JDK和Eclipse CDT的体系结构。 If you are going to stick to the 32 bit compiler.
如果您要坚持使用32位编译器。 Follow these steps:
跟着这些步骤:
Uninstall 卸载
Restart PC 重启电脑
Install 安装
Or you can simply stick to all 64 bit versions but always ensure all their architectures match. 或者,您可以坚持使用所有64位版本,但始终确保其所有体系结构都匹配。 For more info, use this link.
有关更多信息,请使用此链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.