[SOLVED] No Output in Console [message #493340] |
Sat, 24 October 2009 21:22  |
Eclipse User |
|
|
|
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 #1794179 is a reply to message #1573641] |
Sun, 26 August 2018 03:27  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.28223 seconds