delorie.com/archives/browse.cgi | search |
From: | Rodeo Red <rodeored AT netstep DOT net> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Read Me Third: A Short FAQ List |
Date: | Thu, 28 Oct 1999 09:07:03 -0400 |
Organization: | Church of Evangelical Environmental Extremism |
Lines: | 60 |
Message-ID: | <C5627EBAC91F29C2.73A1B5852F12F16F.FBF01DAABDAB246C@lp.airnews.net> |
X-Orig-Message-ID: | <38184A76 DOT 33E23322 AT netstep DOT net> |
References: | <Pine DOT SUN DOT 3 DOT 91 DOT 991020140410 DOT 22660f-100000 AT is> <0A02668AA6DAF2EA DOT B7324B0997533B2E DOT A43653802EA26ABD AT lp DOT airnews DOT net> <7oUXONJSazygooCyeWwSD8msc766 AT 4ax DOT com> |
Abuse-Reports-To: | support at netstep.net to report improper postings |
NNTP-Proxy-Relay: | library1.airnews.net |
NNTP-Posting-Time: | Thu Oct 28 08:06:21 1999 |
NNTP-Posting-Host: | !c*T:-@[-Bb<ZI0 (Encoded at Airnews!) |
Mime-Version: | 1.0 |
X-Mailer: | Mozilla 4.5 [en] (Win98; I) |
X-Accept-Language: | en |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Damian Yerrick wrote: > On Wed, 27 Oct 1999 18:50:31 -0400, > Rodeo Red <rodeored AT netstep DOT net> wrote: > > > This is my current version of Hello.cpp: > > > > #include <iostream.h> > > Problem #1: <iostream.h> is the old way. > > #include <iostream> > > > int main (void); > > Problem #2: A prototype for a function should have a following ; but > the function definition should not. > > int main(void) > > > { > > cout <<"Hello world!\n"; > > Problem #3: The function returns an undefined number. > > return 0; > > > } > > > > I believe this declares the main function in the correct way . However, when I tru > > to compile it this does not create an hello.o program as it should. I get: : > > > > C:\djgpp>gcc -c -Wall hello.cpp > > hello.cpp:4: parse error before `{' > > Problem #2. > > -- To summarize: #include <iostream> int main (void) { cout <<"Hello world!\n"; return 0; } This appears to work great. However I'm more than a little puzzled as to why I even had to ask this question. I got all my advice about writing a sample program from two or three books about C++, none of which even mentioned any of this advice you are talking about. I also remember using rhide to build hello.exe without these changes. Is this because djgpp is just being more exact about the syntax ? Are these books somehow out of date ? Red
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |