From: anthony AT prairienet DOT org (Anthony) Newsgroups: comp.os.msdos.djgpp Subject: Re: Trouble Compiling C++ with DJGPP Date: 17 May 2003 02:58:15 -0700 Organization: http://groups.google.com/ Lines: 36 Message-ID: References: <3EC5615B DOT 6000704 AT earthlink DOT net> NNTP-Posting-Host: 130.126.25.115 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1053165496 5630 127.0.0.1 (17 May 2003 09:58:16 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: 17 May 2003 09:58:16 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Martin Ambuhl wrote in message news:<3EC5615B DOT 6000704 AT earthlink DOT net>... > Anthony wrote: > > > --Snippet-- > > #include > > > > 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 > > int main() > { > std::cout << "Hello world.\n"; > return 0; > } Thanks. This works perfectly with g++. I still wonder why I was able to compile the snippet in the past without the std:: though. It is an exact quote out of a recent book on C++.