www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/22/15:03:42

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Hello, World! == 753 KB
Date: 22 Feb 2002 19:47:51 GMT
Organization: Cornell University
Lines: 62
Sender: asu1 AT cornell DOT invalid (on 132.236.44.13)
Message-ID: <Xns91BD96865D88Dasu1cornelledu@132.236.56.8>
References: <a521gd$42nsi$1 AT ID-76871 DOT news DOT dfncis DOT de> <Xns91BC54E6FD375asu1cornelledu AT 132 DOT 236 DOT 56 DOT 8> <a54hcl$48ide$1 AT ID-76871 DOT news DOT dfncis DOT de>
NNTP-Posting-Host: 132.236.44.13
X-Trace: news01.cit.cornell.edu 1014407271 6247 132.236.44.13 (22 Feb 2002 19:47:51 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 22 Feb 2002 19:47:51 GMT
User-Agent: Xnews/L5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Fausto Arinos de A. Barbuto" <barbuto AT ax DOT apc DOT org> wrote in news:a54hcl
$48ide$1 AT ID-76871 DOT news DOT dfncis DOT de:

> 
> "A. Sinan Unur" <asu1 AT cornell DOT edu> wrote in message:
> 
>> >     That's what I get when I compile the code below with
>> >     "gpp -o hello.exe hello.cpp" (gcc version 3.0.3).
> 
>> this is a faq so i suggest you check it.
> 
>     You're right. I apologize for that.
> 
>> > //---------CUT HERE---------
>> > #include <iostream.h>
> 
>> ^^^ You should use the new style headers so that the compiler
>> catch your errors:
> 
>     Where could I read about those new style headers?

in the C++ standard.
 
>> C:\DOCUME~1\asu1\LOCALS~1\Temp>gpp t.cc -o t.exe -Wall -O2
>> t.cc: In function `int main()':
>> t.cc:6: `cout' undeclared (first use this function)
>> t.cc:6: (Each undeclared identifier is reported only once for each
>> function it appears in.)
> 
>     I compiled the program exactly as you indicated above
>     and got no error/warning messages. An executable was
>     generated and it worked as intended (that is, displaying
>     the "Hello, World!" message).

you will get this error message if you are using a standards compliant 
compiler (e.g. gcc 3.03), you are using the standard header names 
(<iostream> rather than <iostream.h>), and if you do not use std::cout, 
or if you do not have 

using std::cout;

>> you will need a using std::cout; to make your code work.
> 
>     No, I don't. The program works anyway.

see explanation above.

>> > #include <math.h>
>>
>> similarly, use <cmath>.
> 
>     The math.h header was included in the code by mistake.
>     It shouldn't be there. Thanks for the hint anyway!
> 
>     And thanks for taking the time to reply to my note.

you are welcome.

you can find more information about the standard C++ library headers at 
http://www.dinkumware.com/refxcpp.html

Sinan.

- Raw text -


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