From: Rodeo Red 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: X-Orig-Message-ID: <38184A76 DOT 33E23322 AT netstep DOT net> References: <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 On Wed, 27 Oct 1999 18:50:31 -0400, > Rodeo Red wrote: > > > This is my current version of Hello.cpp: > > > > #include > > Problem #1: is the old way. > > #include > > > 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 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