delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/06/14:28:04

From: eighner AT io DOT com (Lars Eighner)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Please Help! (DJGPP set-up and RHIDE)
Date: Mon, 06 Dec 1999 09:10:57 -0600
Organization: Lars Eighner, Author
Lines: 90
Message-ID: <BI9S4AwZqEEL092yn@io.com>
References: <384A2EEB DOT 21B075E1 AT hotmail DOT com>
<OHv24.2381$323 DOT 55226 AT dfiatx1-snr1 DOT gtei DOT net> <384B19BF DOT 12B68D1 AT hotmail DOT com>
<384BC579 DOT A9D8FA05 AT hotmail DOT com>
NNTP-Posting-Host: dillinger.io.com
Mime-Version: 1.0
X-Trace: hiram.io.com 944499486 31655 199.170.88.20 (6 Dec 1999 16:58:06 GMT)
X-Complaints-To: abuse AT io DOT com
NNTP-Posting-Date: 6 Dec 1999 16:58:06 GMT
X-Newsreader: Yarn 0.92 with YES 0.22
X-ISP: Illuminati Online
X-Revision: 1
Originator: eighner AT dillinger-2 DOT io DOT com (Lars Eighner)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In our last episode <384BC579 DOT A9D8FA05 AT hotmail DOT com>,
the lovely and talented knoriko A <knoriko_a AT hotmail DOT com>
broadcast on comp.os.msdos.djgpp:
|Hello again.
|
|I learned about DOS Edit FINALLY, and could read readme.1st.  Thank you.
|  I gave up on RHIDE and used Edit to type "hello world."  I did exactly
|as directed in "Your First Program" guide, however, it didn't work and
|printed a line like this:
|
|hello.c:l: '#include' expects "FILENAME" or <FILENAME>
|
|So I tried :
|
|#include <hello.c>

No, it is highly unlikely that what you want to do is
to include the file itself.

What you want to include is the header for whatever
you are using for I/O.

Probably this is either:

#include <iostream>
if you are using cin

or
#include <stdio.h>
if you are using some form of print

|
|then gcc printed:
|
|hello.c:1: hello.c: No such file or directory (ENOENT)
|
|I'd really appreciate it if anyone could see the source below and let me
|know of any mistake.
|
|***********************************
|
|#include

#include <stdio.h> is what you want here since you are
using printf.  Printf is not part of C.  It is a library function.
So you have to tell the compiler about it.  That is what the
header does.  You could actually copy stdio.h into your program
file at this point to tell C what it needs to know.  #include
is just a more convenient way for you to do that.

|
|int main(void)
|{
|  printf("Hello, world!\n");

You see, C does not know how to printf.  Fortunately someone
has written printf for you and put it in a nice library.
But you have tell C about it.  The header file is what
you are including.  That tells C what it needs to know
about the printf function so that your program will be
compiled to interact properly with the binary in the
library.  The linker will then get the necessary binary
from the library and slam it into your program.  Don't
worry too much about the linker at first -- it will all
happen seamlessly when you compile a simple program to an
.exe.  The main thing is that a header file gives the
compiler essential information about functions that
are used by your program but which are not part of your
program.

|  return 0;
|}
|
|***********************************
|
|Regards,
|knoriko
|
|
|
|


-- 
          Lars Eighner  700 Hearn #101 Austin TX 78703 eighner AT io DOT com
      (512) 474-1920 (FAX answers 6th ring) http://www.io.com/%7Eeighner/
              bookstore: http://www.io.com/%7Eeighner/bookstore/
         A radical is a man with both feet firmly planted in the air.
                          -- Franklin D. Roosevelt --

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019