C++ HelloWorld not printing correctly
I just installed c/c++ development tools for my eclipse and everything is working except no text is being printed in the console when I run the hello world program, but I receive no errors. I'm really stumped, anyone know why this is?
Edit:Ok I realized if that debug it, it works 开发者_开发百科correctly, but not if I run it, any ideas there?
Are you using a 64-bit version of Eclipse? If so, that might be your problem. The 64-bit version doesn't do console output. sigh Try downgrading to the 32-bit version.
On SO, check this question. On the Eclipse forums, check this thread.
Does a window pop up then disappear? It could be printing it in console then closing as soon as it hits the end of the code...
try to make your code like this:
#include <iostream>
#include <conio.h>
using namespase std;
int main()
{
cout << "helllo, world" << endl;
getch();
return 0;
}
You must set the environment so the eclipse can find the c++ compiler.
Go to Computer
and right click Properties
-> advanced system settings
-> enviroment variables
.
Scroll down in system variables
and find the path
(it is named so). Press edit
and append in the path
the value C:\MinGW\bin;C:\MinGW\msys\1.0\bin;
. You will have something like C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\programfiles.......
.
Then start again the eclipse the problem should have been solved.
精彩评论