This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC -3.1 problem with header files
- From: Oscar Fuentes <ofv at wanadoo dot es>
- To: Steve Ettorre <sme at nycap dot rr dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 27 May 2002 23:14:27 +0200
- Subject: Re: GCC -3.1 problem with header files
- References: <20020527203043.GD1526@alb-66-66-254-16.nycap.rr.com>
- Reply-to: gcc-help at gcc dot gnu dot org
Steve Ettorre <sme@nycap.rr.com> writes:
> Hi all-
>
> I have what I think is probably a stupid error on my part, but I could
> use some help. A simple test code such as "test.C":
>
> #include <iostream>
using namespace std; // <<--------------
> int main() {
> cout << " Main: running..." << endl;
> return 0;
> }
or
std::cout << " Main: running..." << std::endl;
>
> will not compile with GCC 3.1. I get the following errors:
>
> test.C: In function `int main()':
> test.C:4: `cout' undeclared (first use this function)
> test.C:4: (Each undeclared identifier is reported only once for each
> function it appears in.)
> test.C:4: `endl' undeclared (first use this function)
>
>
> Obviously, g++ is not seeing the proper system "include" directory
> which on my RedHat system is: /usr/include/g++-v3.
Yes. <iostream> differs from the old non-standard <iostream.h> on that
it declares the identifiers in namespace std (as all Standard C++
Library does).
BTW, be sure you build with 'g++', not 'gcc'.
> What do I have to do to get GCC 3.1 to see the "include" directories?
>
> TIA,
> Steve
>
--
Oscar