Subject: Re: C++ broken
To: Patrick Welche <prlw1@newn.cam.ac.uk>
From: John R. Shannon <john@johnrshannon.com>
List: current-users
Date: 11/13/2003 05:52:46
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I think you want to add:

using namespace std;

On Thursday 13 November 2003 05:41 am, Patrick Welche wrote:
> This is with 8th November source code - hopefully you'll all shout
> "cvs update, it's fixed!", otherwise you'll have to send me to
> elementary coding school:
>
> % cat hellow.cc
> #include <iostream>
>
> int main()
> {
>   cout<<"Hello World!\n";
>
>   return 0;
> }
> % g++ hellow.cc -o hellow -Wall
> hellow.cc: In function `int main()':
> hellow.cc:5: error: `cout' undeclared (first use this function)
> hellow.cc:5: error: (Each undeclared identifier is reported only once for
> each function it appears in.)
>
> or just to check it does look in /usr/include/g++ :
>
> % g++ hellow.cc -v -o hellow -Wall
> Using built-in specs.
> Configured with: /usr/src/tools/gcc/../../gnu/dist/gcc/configure
> --enable-long-long --disable-multilib --enable-threads
> --build=3Di386-unknown-netbsdelf --host=3Di386--netbsdelf
> --target=3Di386--netbsdelf : (reconfigured)
> /usr/src/tools/gcc/../../gnu/dist/gcc/configure --enable-long-long
> --disable-multilib --enable-threads --build=3Di386-unknown-netbsdelf1.6W
> --host=3Di386--netbsdelf --target=3Di386--netbsdelf Thread model: posix
> gcc version 3.3.2 (NetBSD nb1 20031026)
>  /usr/bin/../libexec/cc1plus -quiet -v -iprefix
> /usr/bin/../libexec/i386--netbsdelf/3.3.2/ -D__GNUC__=3D3 -D__GNUC_MINOR_=
_=3D3
> -D__GNUC_PATCHLEVEL__=3D2 hellow.cc -D__GNUG__=3D3 -quiet -dumpbase hello=
w.cc
> -auxbase hellow -Wall -version -o /var/tmp//ccOAx57e.s GNU C++ version
> 3.3.2 (NetBSD nb1 20031026) (i386--netbsdelf)
>         compiled by GNU C version 3.3.2 (NetBSD nb1 20031026).
> GGC heuristics: --param ggc-min-expand=3D38 --param ggc-min-heapsize=3D16=
384
> ignoring nonexistent directory
> "/usr/libexec/i386--netbsdelf/3.3.2/include/g++" ignoring nonexistent
> directory "/usr/libexec/i386--netbsdelf/3.3.2/include/g++/backward"
> ignoring nonexistent directory "/usr/libexec/i386--netbsdelf/3.3.2/includ=
e"
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/include/g++
>  /usr/include/g++/backward
>  /usr/include
> End of search list.
> hellow.cc: In function `int main()':
> hellow.cc:5: error: `cout' undeclared (first use this function)
> hellow.cc:5: error: (Each undeclared identifier is reported only once for
> each function it appears in.)
>
>
> Cheers,
>
> Patrick

=2D --=20

John R. Shannon
john@johnrshannon.com
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iEYEARECAAYFAj+zfqkACgkQOKbCxya4HYvPEACghzbiuK21dcG1vPsRljWWH0Gw
VgsAoLFnJDkxiGhBfu58LCHkROXvm4t6
=3DTnsL
=2D----END PGP SIGNATURE-----