-2

i cannot to see what i write to the console (Eclipse C++) during debugging

    for (int i=0; i<5; i++) {
        cout << i;
    }

How to configure Eclipse writting on console while debuging ?

andrewsi
  • 10,807
  • 132
  • 35
  • 51
Mark
  • 1,513
  • 2
  • 10
  • 11

2 Answers2

0

It is not Eclispe (which is an editor, not a compiler; probably your Eclipse would run a compiler like GCC using the g++ program; and then you are running the compiled executable.).

If you don't see your expected output, it is probably because your output stays buffered.

You could try the std::flush manipulator.

   for (int i=0; i <5; i++)
        std::cout << i << std::flush;

See this question and the several good answers there.

You might read more about the std::endl manipulator. I suggest doing std::cout << std::endl from time to time.

You could consider using the std::clog output stream.

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547