| [SOLVED] No Output in Console [message #493340] |
Sat, 24 October 2009 21:22  |
PehJota Messages: 3 Registered: October 2009 |
Junior Member |
|
|
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] Report message to a moderator
|
|
|
| Re: [SOLVED] No Output in Console [message #495869 is a reply to message #493340] |
Fri, 06 November 2009 08:28   |
ADLR Messages: 2 Registered: November 2009 |
Junior Member |
|
|
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.
[Updated on: Fri, 06 November 2009 08:28] Report message to a moderator
|
|
|
|
|
|
|
|
|
| Re: [SOLVED] No Output in Console [message #676675 is a reply to message #670366] |
Mon, 06 June 2011 01:35   |
 |
Thang Le Messages: 6 Registered: May 2010 Location: Vietnam |
Junior Member |
|
|
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] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02019 seconds