Eclipse CDT using MinGW does not output in console

后端 未结 9 1436
栀梦
栀梦 2020-12-02 11:16

I have a Windows 7 64-bit PC and I am trying to install a free C++ IDE, so I chose to install Eclipse Helios with CDT.

For g++, make and gdb I installed msys and min

9条回答
  •  广开言路
    2020-12-02 12:07

    I ran into the same problem, because of multiple gcc installations on one PC. But Greg's solution only worked partly for me.

    In my case the flush was not done in the application explicitly. While C++ programs often use std::cout << ... << std::endl where the endl does a flush, my program used actual C-output such as the usual printf. The printf could be seen directly when starting the program in the cmd-window. However in eclipse console they were missing. Hence a

    fflush(stdout);
    

    after the printf did the thing for me. That could be an issue within the eclipse console implementation. I guess that's why fixing the Path did not work for some people here.

    An alternative solution instead of setting the PATH within the "Run" settings is to start the whole eclipse using a batch file, which looks essentially like this:

    set PATH=\bin;%PATH%
    start \eclipse.exe
    

    Then any run configuration would use the correct MingW location by default. That might also fix other problems that could arise from using the wrong gcc.

提交回复
热议问题