This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: Looking for OpenGL "hello world"
- From: Fred Kulack <kulack at us dot ibm dot com>
- To: cygwin-xfree at cygwin dot com
- Date: Tue, 28 Dec 2004 09:57:53 -0600
- Subject: Re: Looking for OpenGL "hello world"
- Reply-to: cygwin-xfree at cygwin dot com
cygwin-xfree-owner@cygwin.com wrote on 12/28/2004 03:06:55 AM:
> --- a.c ---
> #include <stdio.h>
> int main(void) {puts("Hello world!");return(0);}
> /* the empty line below is required to compile properly */
>
> -------------
>
> should work just doing gcc -o a a.c.
Hmm....
Is there a reason you go so far as to explicitly indicate that a newline
is required
at the end of the file? Seems like you're being a bit complex?
Is there a good reason? (I do see an old gcc bug talking about gcc
generating 2 warnings
for this occurance, but its like 4 years old).
As far as I know, this requirement is rather esoteric and its difficult
to get it to fail (editors I try always put a newline at the end and even
if you skip
a newline explicitly, all you get is a warning).
Opening a.c in vi for example and saving the file immediately fixes the
problem.
> echo -n '#include <stdio.h>
int main(void) {puts("Hello world!");return(0);}' > a.c
> od -tx1c a.c
0000000 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e
# i n c l u d e < s t d i o .
0000020 68 3e 0a 69 6e 74 20 6d 61 69 6e 28 76 6f 69 64
h > \n i n t m a i n ( v o i d
0000040 29 20 7b 70 75 74 73 28 22 48 65 6c 6c 6f 20 77
) { p u t s ( " H e l l o w
0000060 6f 72 6c 64 21 22 29 3b 72 65 74 75 72 6e 28 30
o r l d ! " ) ; r e t u r n ( 0
0000100 29 3b 7d
) ; }
0000103
> gcc a.c
a.c:2:49: warning: no newline at end of file
"The stuff we call "software" is not like anything that human society
is used to thinking about. Software is something like a machine, and
something like mathematics, and something like language, and
something like thought, and art, and information...
but software is not in fact any of those other things."
Bruce Sterling - The Hacker Crackdown
Fred A. Kulack - IBM eServer iSeries - Enterprise Application Solutions
ERP, Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN (Phone: 507.253.5982 T/L 553-5982)
mailto:kulack/us.ibm.com Personal: mailto:kulack/gmail.com
AIM Home:FKulack AIM Work:FKulackWrk
MSN Work: fakulack/hotmail.com (replace email / with @)