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

From: Germano Percossi <germano.percossi_at_roma2.infn.it>
Date: Tue, 14 Mar 2006 16:58:52 +0100


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.

Maybe you forgot to open the namespace for the standard library?

using namespace std



Germano Percossi
University of Rome "Tor Vergata" and INFN Roma2 Via della Ricerca Scientifica 1
I-00133 Rome Italy
Phone     : 06 7259 4824
Room      : c0 28b
------------------------------------------------------------
Received on Tue Mar 14 2006 - 17:00:41 MET

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