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:
C:\MinGW\lib\gcc\mingw32\4.8.1\include\c++
where the iostream
file is located.
The program compiles just fine and runs but it doesnt print the "!!!Hello World!!!"
message. The code is the ordinary hello world example.
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
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. There are issues with Eclipse CDT and C++ compiler when their architectures mismatch. Please see which architecture of Java, JDK, Eclipse CDT are you using. If you are going to stick to the 32 bit compiler. Follow these steps:
Uninstall
Restart PC
Install
Or you can simply stick to all 64 bit versions but always ensure all their architectures match. For more info, use this link.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.