No Console Output (MinGW, CDT) [message #629872] |
Wed, 29 September 2010 15:35  |
Colin Messages: 3 Registered: September 2010 |
Junior Member |
|
|
Hey all-
I seem to be having an issue getting the Eclipse Console to output a running C++ program using CDT and MinGW. The program simply terminates without any output. If i open up the .exe in a cmd window, it runs perfectly fine.
For example, implementing the default "HelloWorld" template program in a new C++ project, ie-
#include <iostream>
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
-results in not output to the console within Eclipse, after selecting 'Run As --> Local C/C++ Application'. I can view the results of the build process console output, but no actual program output (remains blank).
I've been scanning the web and these forums all day, with no luck (including finding some potentially similar problems with non-working answers). Anyone have any potential solutions?
I'm currently running Helios SP1 and CDT 7.0.1 on Windows 64-bit.
Thanks in advance!
EDIT: Implementing the default C (not C++) "HelloWorld" template program in a new C project does produce output to the console. It seems only C++ output is not being shown.
[Updated on: Wed, 29 September 2010 15:50] Report message to a moderator
|
|
|
|
|
|
|
| Re: No Console Output (MinGW, CDT) [message #630143 is a reply to message #630135] |
Thu, 30 September 2010 15:01   |
Charis Messages: 2 Registered: September 2010 |
Junior Member |
|
|
Thank you for this solution, friend.
I also had the same problem, and now it is fixed. I must note, however, that all I had to do was download the 32-bit version of Eclipse C++. Replacing the 64-bit JDK with the 32-bit one was not necessary 
Also, there are a few weird additional symptoms you might have not noticed. Eg, the program does run but it terminates with a very large negative number instead of 0. Also, debugging the program partially works in that it does show the output when I move step by step, but then it breaks down when I try to enter input.
[Updated on: Thu, 30 September 2010 15:07] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
| Re: No Console Output (MinGW, CDT) [message #643238 is a reply to message #643081] |
Mon, 06 December 2010 03:32   |
Axel Mueller Messages: 1829 Registered: July 2009 |
Senior Member |
|
|
| Sunghyun wrote on Sat, 04 December 2010 02:15 |
Hi, I've just tried the workaround method mentioned above.
But it still doen't work. Could you be more specific on the procedures?
I use 64 bit JDK and installed Helios Eclipes 32bit which failed to
find the jre although it was in the PATH so I copied the jre folder into
Eclipse. It opens but fails to output in the console. Of course I did this on
Windows 7 64bit.
|
Eclipes 32bit needs a 32Bit JRE/JDK!
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
|
|
| Re: No Console Output (MinGW, CDT) [message #649727 is a reply to message #629872] |
Thu, 20 January 2011 08:00   |
Javier Villa Messages: 1 Registered: January 2011 |
Junior Member |
|
|
Hi,
I am running 64-bit Eclipse (W7 64bit, jdk 1.6 64bit) and was
having the same issue. I tried the FAQ suggestion but didn't
work, as well as flushing manually.
I was getting output if I debugged the app, though. What I did
was head to the location pointed above:
Project Properties -> C/C++ Build -> Settings -> Tool Settings
And from there I noticed (Tool Chain Editor) that the project was using Cygwin for building (I had tried it but couldn't get everything set up right, so I switched to Mingw afterwards, or so I thought lol). Changing to Mingw I got console output without having to revert to 32bit on eclipse/jdk.
No -static flag or additional path settings were set up either.
So in a nutshell, changing to MinGW and ensuring it is used for the current project was what fixed it for me, hope it helps somebody.
Edit: haven't tested for C++ output / cout
[Updated on: Thu, 20 January 2011 15:03] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: No Console Output (MinGW, CDT) [message #809350 is a reply to message #724073] |
Tue, 28 February 2012 14:34   |
|
sydraps wrote on Sat, 10 September 2011 18:47Hi Guys,
I fixed the problem on my win 7 x64 PC. In the Eclipse window go to Preferences > C/C++ (Expand it) > Environment > Add:
"Name:PATH"
"Value:C:\MinGW\bin"
Hi,
thanks a lot for that, it resolved this problem for me.
But one thing:
On Eclipse 3.7.2 and CDT 8.0.2 the preferences for environment variables can be found in Eclipse at:
Window ->Preferences->C/C++->Build->Environment
Running Eclipse 3.7 64Bit + JDK 1.7.3 64Bit on Win7 64Bit.
Thanks again!
Best regards...
|
|
|
|
| Re: No Console Output (MinGW, CDT) [message #1058151 is a reply to message #1006589] |
Sun, 12 May 2013 11:49  |
Stefan van Dongen Messages: 1 Registered: May 2013 |
Junior Member |
|
|
Hi all,
To add some more peculiarities to the behavior described in this topic I'd like to share my experiences.
I'm running Windows 7 and Eclipse Juno 64 bit with MinGW.
I use the standard C++ hello world example to test the debugger and running the application.
From the start I have had output in the console in both debug and run mode. However, the console would not take any input.
After trying the many solutions listed here and elsewhere I had one success.
Adding the MinGW path to the environment variables of the run configuration enables the console to take user input.
Repeating this step for the debugger did not solve it there.
Adding the flush commands did not solve the problem.
Adding static options to the MinGW linker under Project Properties->C/C++ Build->Settings->MinWG C++ Linker->Miscellaneous did not solve the problem.
MinGW is set as the debugger at all the relevant places. In the main Debug Configuration tab all settings refer to the Debug build.
When I terminate the debugger the console buffer does seem to be flushed, as any characters I typed are sent to the program. Additionally, the termination command of the debugger also appears to generate some output that is sent to the program.
Output looks like this:
HelloWorld!
HelloWorld!
HelloWorld!
HelloWorld!
HelloWorld!
To exit, press 'm'
aaaaa
You just entered a. You need to enter m to exit.
You just entered a. You need to enter m to exit.
You just entered a. You need to enter m to exit.
You just entered a. You need to enter m to exit.
You just entered a. You need to enter m to exit.
You just entered 2. You need to enter m to exit.
You just entered 0. You need to enter m to exit.
You just entered -. You need to enter m to exit.
You just entered g. You need to enter m to exit.
You just entered d. You need to enter m to exit.
You just entered b. You need to enter m to exit.
You just entered -. You need to enter m to exit.
You just entered e. You need to enter m to exit.
You just entered x. You need to enter m to exit.
You just entered i. You need to enter m to exit.
You just entered t. You need to enter m to exit.
Any ideas to fix this behavior of the debugger are more than welcome. To stress, in Run mode the console works fine.
Many thanks,
Stefan
|
|
|