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
Had this issue on 64-/32-bit eclipse Kepler CDT to work on a openCV/wxWidgets tool, Win7, using MinGW to build.
If anyone comes across this while having this issue and are working with openCV you will already know that there are many outdated openCV building/installing instructions all over the internet.
One I had was to go to Build Settings -> Linker -> Miscellaneous and inside of the Linker Flags text entry box, type in
-Wl,--subsystem,windows -mwindows
However, this disables cout from outputting to a command line terminal in windows.
Doing some more digging this looks intentional, apparently the -mwindows involves directing STDOUT away from a command line specifically to a GUI-like application.
Also, removing -mwindows
and just leaving in -Wl,--subsystem,windows
accomplishes the task of redirecting STDOUT anyway away from the command line all the same.
Now mind you, I haven't built up anything yet outside of a hello world program involving wxWidgets and openCV, so I am not at the point of doing a cout into a part of a GUI so I don't know if that functionality would now be broken or if it would print out to the GUI object, as well as a command line terminal.
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=<mymingwlocation>\bin;%PATH%
start <myeclipselocation>\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.
Or set the linker option -static
.
Works for me at least.