From: jstacey AT plato DOT wadham DOT ox DOT ac DOT uk (J-P) Newsgroups: comp.os.msdos.djgpp Subject: Re: hello world program still not working Date: 16 Jul 2000 13:42:53 +0100 Organization: Wadham College Oxford Lines: 44 Message-ID: <8ksakd$18n$1@plato.wadham.ox.ac.uk> References: <8ks68a$8ht$1 AT newsflood DOT tokyo DOT att DOT ne DOT jp> NNTP-Posting-Host: plato.wadham.ox.ac.uk X-Trace: news.ox.ac.uk 963751374 5697 163.1.164.74 (16 Jul 2000 12:42:54 GMT) X-Complaints-To: newsmaster AT ox DOT ac DOT uk NNTP-Posting-Date: 16 Jul 2000 12:42:54 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <8ks68a$8ht$1 AT newsflood DOT tokyo DOT att DOT ne DOT jp>, Dan and Shelly wrote: >I found out that I needed to download and extract the gcc program. So I did >that and tried the hello world program again using rhide. I typed in: > >#include >int main() >{ >printf("Hello world!\n"); >exit(0); >} > > >But now when I try to run the above program in rhide, I get the error >message that the #include is expecting a file name after it. Did I >forget to download something else beside the gcc program? Not at all. You've told the compiler "before you compile this program, include a file which tells you where to find, for example, printf". But then you haven't told it what file to include. All of the standard functions - printf, alloc, all that stuff - are "linked" with the program when you compile it. But unless you tell the compiler "don't worry: you'll find this function later on in the standard function library" it gets confused. What you want is "#include " . If you ever use a function that isn't one of your /own/ (like printf) then you need to include a header file. Try typing looking up the help on printf: it will tell you what you need to include. Now try looking up the help on, say, alloc. It will tell you you need to include (or is it ?) The header (".h") files give function "declarations" ("I might be using THIS function, Mr Compiler). The library gives function "definitions" ("This is what the function looks like and does, Mr Compiler") and so is only linked with your program when you actually want to create a .exe file. The standard library is linked automatically: things like the maths libraries aren't. The declarations tell the compiler immediately that printf(3) is illegal, whereas printf("Hello, World!\n") isn't. The definitions tell the compiler what printf actually does. J-P