3

I've created c++ "Hello World" sample project in eclipse using "cygwin GCC" Toolchain.

Project Compiles and run.The problem is that I don't see my "Hello World" Output in console below.

The Interesting fact is when I run my project in "Debug" mode , I do see an output after I execute :

    cout << "!!!Hello World!!!" << endl; 

How can I see my console output in simple "Run mode" ? I'm Using Eclipse Juno...

Ivelius
  • 4,953
  • 7
  • 30
  • 54

2 Answers2

4

Thanks @einpoklum , following your links I've found a solution !

Make sure to run Eclipse as Administrator ! That's it :)

Of course if it still doesn't work , refer to @einpoklum answer.

Ivelius
  • 4,953
  • 7
  • 30
  • 54
  • Actually, that should _not_ be necessary. After all, many users can't use administrator privileges. Can you tell what you need them for, exactly? – einpoklum Apr 18 '13 at 12:16
  • 1
    Well... I don't fully understand why I need Administrator privileges. But it does solves the problem. Found it here : http://stackoverflow.com/a/9779984/930171 – Ivelius Apr 18 '13 at 12:41
  • It just shifts the problem, it doesn't solve it, because you don't really need admin privileges. You need to prevent Eclipse or GCC or what-not from trying something which requires admin privileges. – einpoklum Apr 18 '13 at 12:49
  • Ugh finally. Thank you for this answer. It would be great to not need it but I don't care to figure out the source issue like others suggest I just want it to work. – ian.shaun.thomas Apr 28 '13 at 05:30
2

This is a widely-reported problem with multiple possible solutions.

  • It might be your PATH environment variable. Make sure it contains C:\Cygwin\bin or wherever you installed Cygwin to. If that's missing, you might not be able to load the cygwin1.dll and Eclipse doesn't report that well enough.
  • Maybe it's due to output buffering. Try adding

    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);`
    

    at the start of your main function.

  • Some people suggest trying a 32-bit version of Eclipse (and JRE). I would try to avoid going down that road...

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • I've added C:\Cygwin\bin to my PATH environment variable,nothing have changed.Those buffer commands didn't help either.Just to make things clear , I create a new C++ project from template (Hello World) using cygwin toolchain. – Ivelius Apr 18 '13 at 07:16