delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/24/14:18:40

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: problems including iostream.h
Date: Sun, 20 Jul 1997 22:37:02 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 47
Message-ID: <33D2930E.460@cs.com>
References: <33C99B62 DOT 7A8E142F AT hotmail DOT com> <33D0C924 DOT 27DD AT lr DOT net>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp101.cs.com
Mime-Version: 1.0
CC: Wald0 <waldo_rx AT hotmail DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Isaac Waldron wrote:
> 
> try using code like this:
> 
> #include <iostream.h>
> 
> void main()
> {
>         cout << "Hello World.";
> }
> 
> Also, since iostream.h is a C++ only file, make sure your filename has a
> cpp extension.

If you're going to post examples, try to make them adhere to standard
programming conventions.  main() must always return an integer.  Also,
gcc can recognize C++ programs with the extensions .C (capital c), .cc,
and .cpp.  And you're omitting the most important part, linking the C++
library.

To correctly compile the above program, you must use one of these two
command lines:

gcc -o hello.exe hello.cpp -lgpp

gxx -o hello.exe hello.cpp

'gxx' takes care of linking the C++ libraries for you.  If you use
RHIDE, you don't need to worry about this as long as you give your
source file a correct name.

If you have further problems, please consult the 'readme.1st' file
and/or the DJGPP Frequently Asked Questions list (v2/faq210b.zip from
SimTel or online at http://www.delorie.com/djgpp/v2faq/).  You won't be
disappointed.

-- 
John M. Aldrich <fighteer AT cs DOT com>                      

* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
  causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
  again.
* It doesn't necessarily do it in chronological order, though.
 
                                       --- Douglas Adams

- Raw text -


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