[SOLVED] No Output in Console [message #493340] |
Sun, 25 October 2009 01: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 06:06] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: [SOLVED] No Output in Console [message #676675 is a reply to message #670366] |
Mon, 06 June 2011 05:35 |
Thang Le Messages: 10 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 06:21] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05767 seconds