delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/05/04/08:46:17

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Thomas Tutone" <Thomas8675309 AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Fwd: Help! "cout" compile error
Date: 4 May 2005 05:44:04 -0700
Organization: http://groups.google.com
Lines: 59
Message-ID: <1115210644.282029.260660@f14g2000cwb.googlegroups.com>
References: <1f9 DOT 90df4e3 DOT 2fa986c8 AT aol DOT com>
NNTP-Posting-Host: 209.190.129.119
Mime-Version: 1.0
X-Trace: posting.google.com 1115210648 15668 127.0.0.1 (4 May 2005 12:44:08 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Wed, 4 May 2005 12:44:08 +0000 (UTC)
User-Agent: G2/0.2
Complaints-To: groups-abuse AT google DOT com
Injection-Info: f14g2000cwb.googlegroups.com; posting-host=209.190.129.119;
posting-account=HdoPKwwAAACoqN8RoXx_KSaQnAnRk5uR
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j44Cj2W0014403
Reply-To: djgpp AT delorie DOT com

DoObi DOT  DOT  DOT  AT aol DOT com wrote:
> Sorry to be sending this message again. I don't know if I sent it
wrong the
> first time or not.  I did get one response but I didn't  understand
it, it
> didn't really explain anything.  If Anyone can help me, I  have
forwarded my
> question again, or If someone could let me know if I am  posting this
wrong. My
> intent is to send it to the newsgroup. Any and all help  is
appreciated. Thanks
> again

> [ Attached Message ]
> From: DoObi DOT  DOT  DOT  AT aol DOT com
> To: d DOT  DOT  DOT  AT delorie DOT com
>Date: Fri, 29 Apr 2005 00:01:47 EDT
> Local: Fri,Apr 29 2005 12:01 am
> Subject: Help! "cout" compile error


> Help!! I read the FAQ blah Blah Blah and tried all that jazz I'm
sposed to
> do.  That being my disclaimer/shirking-off-of-any­-further
>
responsibility-of-reading-or-f­urther-and-likely-extensive-re­search:
When I try  > to compile "hello
> world" this is the compile error message I get:


> C:\djgpp>gpp hello.cpp -o hello.exe
> hello.cpp: In function 'int main(  )':
> hello.cpp:6: error:'cout' undeclared (first use this  function)
> hello.cpp:6: error:(Each undeclared identifier is reported only  once
for
> each function it appears in.)

You don't provide a listing of the program you tried to compile, which
makes it slightly difficult to tell you for sure, but my crystal ball
is working fairly well today.  The answer is that your program is not a
valid C++ program.  Here is a valid C++ "Hello World" program:

#include <iostream>
int main()
{
    std::cout << "Hello World!" << std::endl;
}

My guess is that you omitted the "std::" before "cout."  If you want to
know _why_ you need a "std::" there, please get a C++ book written
after 1997 - that's when they changed the C++ standard to use the std
namespace.  And if your program compiles fine as is on other compilers,
that's because those other compilers are old and don't comply with the
C++ standard.

Best regards,

Tom


- Raw text -


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