Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » [SOLVED] No Output in Console(Only Displays "<terminated>")
[SOLVED] No Output in Console [message #493340] Sat, 24 October 2009 21:22 Go to next message
Eclipse UserFriend
I'm using Eclipse Galileo on Windows with MinGW. I'm trying to build and run a simple C++ program. It builds fine, and I can run the program from cmd with no problems. But if I try to run the program in Eclipse, I get nothing in the Console view. It says "<terminated>" though. In my web searching I've seen others experiencing this same problem, but unfortunately I haven't seen any solution.

This is the sample program I'm trying to run (just output, nothing complicated):

#include <cstdio>


int main(int argc, char* argv[]) {
	
	printf("Hello.\n");
	fflush(stdout);
	
	return 0;
	
}


Anyone know how to fix this?

EDIT:

Ah, I figured out the problem. Adding the linker flag "-static-libgcc" will fix at least the following three issues that I know of: programs built with MinGW don't work on machines that don't have MinGW installed; programs don't run in the Eclipse Console; and gdb fails when the program starts.

For anyone who may need to know:
To add this flag in Eclipse, go to Project->Properties. Under "C++ Build", select "Settings". Under "MinGW C++ Linker", select "Miscellaneous". Add "-static-libgcc" to the "Linker flags" field. You may have to do this for your other build configurations and projects.

[Updated on: Sun, 25 October 2009 02:06] by Moderator

Re: [SOLVED] No Output in Console [message #495869 is a reply to message #493340] Fri, 06 November 2009 08:28 Go to previous messageGo to next message
Eclipse UserFriend
Actually I do have the same problem, but I cannot solve it with your solution. Maybe you have an idea what I could do, to do this for plain C.

I do get my console output after the programm has already ended, so I cannot give any input to the tool. Everthing works in cmd.exe, but not in the eclipse console view. Crying or Very Sad

[Updated on: Fri, 06 November 2009 08:28] by Moderator

Re: [SOLVED] No Output in Console [message #499461 is a reply to message #495869] Sun, 22 November 2009 14:34 Go to previous messageGo to next message
Eclipse UserFriend
I'm pushing this topic, since I do have the same issue. Program runs fine from cmd on a windows XP stem build with mingw and eclipse CDT (Galileo). But I don't get any output to the eclipse console, except when I hit the red "terminate" square.

I haven't tried fflush yet, but it should work without it or? And yes, I've set the run configuration as described in the manuals.

And as it looks like, I'm not the only one.

Best regards,

Tobias
Re: [SOLVED] No Output in Console [message #505090 is a reply to message #499461] Sat, 26 December 2009 08:46 Go to previous messageGo to next message
Eclipse UserFriend
I would like to put topic forward once again. I am unable to see an output within an eclipse console for C program.

I am using Windows 7_64 bit with Cygwin on top.
From cmd.exe everything works fine.

I have tried almost every workaround that I have found in the net, however none of them helped to solve the problem.

If anyone by any chance know how to overcome this issue for C, please help.

Thanks!
James
Re: [SOLVED] No Output in Console [message #505150 is a reply to message #493340] Sun, 27 December 2009 19:30 Go to previous messageGo to next message
Eclipse UserFriend
Yes, you do need to include calls to fflush to flush the stdout buffer. I think this is because the cstdio library treats the Eclipse Console as a file stream, and output is not implicitly flushed as often as with a standard terminal (like cmd.exe). I think it's good practice to explicitly flush the output buffer anyway, just to be sure it's printed in all possible environments.

If you get console output after the program has ended, then that sounds to me like the output buffer isn't being flushed. As I said, using "fflush(stdout);" and adding "-static-libgcc" to the linker flags (if you're using MinGW/GCC, other compilers probably have some other flags to statically link their runtime libraries) seems to make it work, at least for me.
Re: [SOLVED] No Output in Console [message #669328 is a reply to message #505090] Mon, 09 May 2011 19:00 Go to previous messageGo to next message
Eclipse UserFriend
I have exactly the same issue.

System is Win Pro x64 with Eclipse Helios CDT and Cygwin.

With Windows XP in the same machine, same configuration everything was ok, now with x64 issue arises.

Running the program from console or by using debugging in Eclipse shows the output.

Regards,
Re: [SOLVED] No Output in Console [message #669682 is a reply to message #669328] Wed, 11 May 2011 03:23 Go to previous messageGo to next message
Eclipse UserFriend
There were some postings in this forum about problems with x64 on Windows. I do not remember if this problem as resolved or a workaround exists. You should do a search on this forum.
Re: [SOLVED] No Output in Console [message #670366 is a reply to message #669682] Fri, 13 May 2011 13:00 Go to previous messageGo to next message
Eclipse UserFriend
[nevermind]

[Updated on: Fri, 13 May 2011 13:01] by Moderator

Re: [SOLVED] No Output in Console [message #676675 is a reply to message #670366] Mon, 06 June 2011 01:35 Go to previous messageGo to next message
Eclipse UserFriend
i got the same problem: cannot display to eclipse console even though i added "-static-libgcc" to the linker flags. i am using win7 64 bit, eclipse helios, CDT 7.0.2, MinGW 5

-------------
i downgrated to CDT 7.0.0 too but was still not resolve the problem

thanks

[Updated on: Mon, 06 June 2011 02:21] by Moderator

Re: [SOLVED] No Output in Console [message #698172 is a reply to message #676675] Mon, 18 July 2011 19:29 Go to previous messageGo to next message
Eclipse UserFriend
I was getting the same behavior on Win 7 64 Bit. Adding the -static-libgcc helped get things to show up in the debugger view, but they still didn't show when running in C++ view. However when I added a PATH variable set to C:\MinGW\bin in the Run Configuration, then I saw stdout when running from a normal run configuration in the C+ view. HTH.
Re: [SOLVED] No Output in Console [message #726179 is a reply to message #698172] Fri, 16 September 2011 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
I added a PATH variable set to C:\MinGW\bin in the Run Configuration


Tyvm for this solution. My console now has output Very Happy

[Updated on: Fri, 16 September 2011 14:13] by Moderator

Re: [SOLVED] No Output in Console [message #726282 is a reply to message #726179] Fri, 16 September 2011 23:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jarrick Chagma

"Shane" wrote in message news:j502st$gfn$1@news.eclipse.org...

>Tyvm for this solution. My console now has output :d

Yes, and mine too now. But why is this necessary? I am using Eclipse 3.7
but this wasn't necessary with Eclipse 3.6.2.

--
Regards,

Jarrick
icon14.gif  Re: [SOLVED] No Output in Console [message #768931 is a reply to message #698172] Tue, 20 December 2011 23:29 Go to previous messageGo to next message
Eclipse UserFriend
Thanks solved my problem

Thanks,
Sathya
Re: [SOLVED] No Output in Console [message #788601 is a reply to message #768931] Wed, 01 February 2012 20:39 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for posting about the path setting. This did it for me as well. - SamV
Re: [SOLVED] No Output in Console [message #817928 is a reply to message #493340] Sat, 10 March 2012 17:18 Go to previous messageGo to next message
Eclipse UserFriend
It helped me too!
Re: [SOLVED] No Output in Console [message #1015529 is a reply to message #726179] Fri, 01 March 2013 01:16 Go to previous messageGo to next message
Eclipse UserFriend
This solved my problem with Juno and CDT. The year is 2013.

But I already set PATH to my MinGW in Window -> Preferences -> Build -> Environment! why do I need to do this also to see output in Console?
Re: [SOLVED] No Output in Console [message #1067227 is a reply to message #493340] Sun, 07 July 2013 14:58 Go to previous messageGo to next message
Eclipse UserFriend
Worked like a Charm !!!... Thanks. Using Eclipse with Cygwin.
Re: [SOLVED] No Output in Console [message #1573641 is a reply to message #1015529] Mon, 19 January 2015 16:37 Go to previous messageGo to next message
Eclipse UserFriend
Windows 7 x64; Eclipse Juno 64 bit; MinGW-W64; year 2015!

The good news; the Solution still works, but... this means the "feature" is still there, too. What the hack...

As mentioned above the path is supposed to be set already under project\properties\C/C++ Build\Environment\Path so where is the difference?

Does anybody have an explanation for this behavior? Thanks in advance.
Re: [SOLVED] No Output in Console [message #1794179 is a reply to message #1573641] Sun, 26 August 2018 03:27 Go to previous message
Eclipse UserFriend
Hi All, I am not sure whether this is really resolved . As per my understanding redirecting console to external helps to see print output in real time. I have tried to explain it in youtube, Just search for embedkari
Let me know if it helps. Have a Great time
Previous Topic:Building from CLI works but not from IDE itself
Next Topic:Unable to debug with Neon and TDM-GCC
Goto Forum:
  


Current Time: Wed Jul 23 23:37:19 EDT 2025

Powered by FUDForum. Page generated in 0.28223 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top