C Programming with Eclipse [message #113973] |
Thu, 05 August 2004 13:00 |
Eclipse User |
|
|
|
Originally posted by: eclipse01.voetter.at
Ahoi,
after a long time im back to C Programming.
I decided to use Eclipse 3.0 with CDT 2.0 as a development environment
(Windows XP pro, cygwin - gcc & co) for my "Hello World" Projects.
After installing the software i run into serious troubles.
The "Managed Make" didn't work (out of the box), so I tried it with
"Standard Make"
1) New Project - "Standard Make" - "FirstSteps"
2) new File - "hello.c"
// ------- hello.c -------
#include <stdio.h>
int main()
{
printf("Hello World\n");
return(0);
}
// ------- hello.c -------
3) new File - "makefile"
// ------- makefile -------
all: clean hello.exe
hello.exe: hello.c
gcc -g -Wall -o hello.exe hello.c
clean:
rm -f hello.exe
// ------- makefile -------
4) Trying to build the target "all" - failed - since make was not found.
I had to append "C:\cygwin\bin" to the systems PATH Setting
(System Properties / System / Advanced / Environment)
(sorry if it doesnt match exactly, since i have a german windows version, I
dont know the english menu names)
5) After that the build worked, although I got a nasty make warning:
No newline at end of file - probably an platform problem, but dos2unix
doesnt solve it.
6) When I now start the executable the dos windows comes up - and disapears
after 100ms when to program has finished. But there is no "Close on Exit"
option in the file property settings, it seems that the file isn't
recognised as "dos executable". Seems to be a problem of the gcc port, any
ideas which switches i have to use?
7) .. to be continued ..
Ok, enough for my first posting here, thanks in advance
amin
|
|
|
|
Re: C Programming with Eclipse [message #114007 is a reply to message #113973] |
Thu, 05 August 2004 13:28 |
Eclipse User |
|
|
|
Originally posted by: e.egberts.tantec.de
> 5) After that the build worked, although I got a nasty make warning:
> No newline at end of file - probably an platform problem, but dos2unix
> doesnt solve it.
It's an eclipse warning, because some compilers don't like files which
end without newline. Hit [Enter] at end of file after closing bracket
oder #endif and the warning is done.
> 6) When I now start the executable the dos windows comes up - and disapears
> after 100ms when to program has finished. But there is no "Close on Exit"
> option in the file property settings, it seems that the file isn't
> recognised as "dos executable". Seems to be a problem of the gcc port, any
> ideas which switches i have to use?
This seems to be a normal program execution. Does the window stay, when
the program is waiting for input, maybe using getline()?
I know Eclipse catching the console and you should see cin/cout in
Eclipse console, but only while the program is running.
HTH,
Ed
|
|
|
Re: C Programming with Eclipse [message #114053 is a reply to message #113995] |
Thu, 05 August 2004 13:44 |
Eclipse User |
|
|
|
Originally posted by: eclipse01.voetter.at
> > The "Managed Make" didn't work (out of the box), so I tried it with
> > "Standard Make"
>
> How, exactly, did the managed build project not work? If you can give me
> a specific scenario that fails, we can look into solving it.
>
I just tried it again, now it works.
I think the reason was the missing
<PATH_TO_CYGWIN_BIN>
setting in the windows system property.
> This is a warning from GCC. Put a newline at the end of your file.
>
I tried to append <newlines> to the make file with no effect.
After your hint I appended the newline to hello.c - Now it works without
warning, thanks a lot!
I got a hint to my "non recognised" dos executeable with the missing "close
on exit" option: "use djgpp"
I haven't tried it yet, is there definitly no way with cygwin and gcc?
Thanks a lot
aRmin
|
|
|
Re: C Programming with Eclipse [message #114178 is a reply to message #114007] |
Thu, 05 August 2004 14:07 |
Eclipse User |
|
|
|
Originally posted by: eclipse01.voetter.at
"Edzard Egberts" <e.egberts@tantec.de> schrieb im Newsbeitrag
news:cetcd3$mcn$1@eclipse.org...
>
> It's an eclipse warning, because some compilers don't like files which
> end without newline. Hit [Enter] at end of file after closing bracket
> oder #endif and the warning is done.
>
solved - thanks
> > 6) When I now start the executable the dos windows comes up - and
disapears
> > after 100ms when to program has finished. But there is no "Close on
Exit"
> > option in the file property settings, it seems that the file isn't
> > recognised as "dos executable". Seems to be a problem of the gcc port,
any
> > ideas which switches i have to use?
>
> This seems to be a normal program execution.
>
yes, think so to - and if i call it directly in a dos box - it works.
> Does the window stay, when
> the program is waiting for input, maybe using getline()?
>
i changed hello.c to:
// -- hello.c -- //
#include <stdio.h>
int main()
{
printf("Hello World\n");
printf("\nEnter to Continue..");
getchar();
return(0);
}
// -- hello.c -- //
Now it works as expected - but the window is still disapearing when the
program terminates (regulary, after hitting <enter>).
Think the problem is - it istn recognised as dos executeable - so there is
no "Close on Exit" Option to uncheck - which would prevent this strange
behaviour.
> I know Eclipse catching the console and you should see cin/cout in
> Eclipse console, but only while the program is running.
>
I cant see any output on the "eclipse console".
I think you mean the same think which i knowm from the JDT?
The next question - i just renamed FirstStepsManaged to FirstSteps - how can
i tell the program to buils hello.exe instead of FirstStepsManaged.exe in
the Debug Folder?
Thanks in advance
aRmin
|
|
|
Powered by
FUDForum. Page generated in 0.03418 seconds