Re: "`cout' undeclared" despite #include <iostream>

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 14 Mar 2006 15:38:20 +0100 (MET)


cout, cerr, etc are in the std:: namespace. You have 3 solutions
  1-specify std::cout, etc
  2-add the statement
    using namespace std;
  3- replace #include <iostream> by

     #include <Riostream.h>
    that will take care of the correct definitions on all machines

Rene brun

On Tue,
14 Mar 2006, Vassili
Maroussov wrote:

> Dear ROOTers,
>
> I cannot compile the file in the attachment, although the <iostream> is
> included:
>
> ----------------------------
> [pcmspur5] ~/TreePlay > g++ -c count_trees.cxx -I`root-config --incdir`
> count_trees.cxx: In function `int count_trees(const char*)':
> count_trees.cxx:20: `cerr' undeclared (first use this function)
> count_trees.cxx:20: (Each undeclared identifier is reported only once for
> each
> function it appears in.)
> count_trees.cxx:20: `endl' undeclared (first use this function)
> count_trees.cxx:45: `cout' undeclared (first use this function)
> [pcmspur5] ~/TreePlay >
> ----------------------------
>
> What may be a reason for that? I use ROOT 5.06 and gcc 3.2.3 (Red Hat Linux
> 3.2.3-53)
>
> Regards,
>
> Vassili.
>
>
Received on Tue Mar 14 2006 - 15:38:25 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET