delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/05/16/18:15:04

Message-ID: <3EC5615B.6000704@earthlink.net>
From: Martin Ambuhl <mambuhl AT earthlink DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
X-Accept-Language: en-us, en, de, fr, ru, el, zh
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trouble Compiling C++ with DJGPP
References: <e3d7c716 DOT 0305161346 DOT 61886eff AT posting DOT google DOT com>
Lines: 32
Date: Fri, 16 May 2003 22:09:03 GMT
NNTP-Posting-Host: 65.145.36.16
X-Complaints-To: abuse AT earthlink DOT net
X-Trace: newsread2.prod.itd.earthlink.net 1053122943 65.145.36.16 (Fri, 16 May 2003 15:09:03 PDT)
NNTP-Posting-Date: Fri, 16 May 2003 15:09:03 PDT
Organization: EarthLink Inc. -- http://www.EarthLink.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Anthony wrote:

> --Snippet--
> #include <iostream>
> 
> int main()
> {
>     cout << "Hello world.\n";
>     return(0);
> }
> -----------
> 
> --Error--
> hello.cc: In function 'int main()':
> hello.cc:5: 'cout' undeclared (first use this function)
> hello.cc:5: (each identifier reported only once)
> ---------

[Description of much wasted effort]

cout is part of the std namespace in C++.  You must say so, in any 
implementation of the real language C++, including g++.  One way of 
doing so is:

#include <iostream>

int main()
{
     std::cout << "Hello world.\n";
     return 0;
}

- Raw text -


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