Ivelius
Ivelius

Reputation: 5013

Eclipse C++ see output only when debugging

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

Upvotes: 3

Views: 2068

Answers (2)

einpoklum
einpoklum

Reputation: 131525

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

Upvotes: 2

Ivelius
Ivelius

Reputation: 5013

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.

Upvotes: 4

Related Questions