Ryan Stull
Ryan Stull

Reputation: 1096

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?

enter image description here Edit:

Ok I realized if that debug it, it works correctly, but not if I run it, any ideas there?

Upvotes: 3

Views: 3473

Answers (4)

peri
peri

Reputation: 1

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.

Upvotes: 0

Steve Blackwell
Steve Blackwell

Reputation: 5924

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.

Upvotes: 6

shengy
shengy

Reputation: 9749

try to make your code like this:

#include <iostream>
#include <conio.h>

using namespase std;

int main()
{
  cout << "helllo, world" << endl;
  getch();
  return 0;
}

Upvotes: 1

andrw
andrw

Reputation: 820

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...

Upvotes: 2

Related Questions