Subject: Maybe this is in some C++ FAQ, but maybe not
To: None <tech-toolchain@netbsd.org>
From: Lloyd Parkes <lloyd@must-have-coffee.gen.nz>
List: tech-toolchain
Date: 11/08/2003 21:59:12
I'm using c++ from NetBSD-current (so it's GCC 3.3.2), and my "Hello,
world" program doesn't work with iostream.h. iostream works fine, but
I'm trying to build someone else's library, and I'm not sure how much
work would be involved in reworking it.

The fact that ISO have been reinventing the C++ library doesn't fit
well with the fact that I'm a C programmer who doesn't try keeping up
with C++ at the best of times.

The following program (paraphrased from Stroustrup 2e) doesn't work.

	#include <iostream.h>
	main ()
	{
		cout << "Hello, world\n";
	}

The following program (written by guesswork) does work.

	#include <iostream>
	main ()
	{
		std::cout << "Hello, world\n";
	}

Both are compiled with "g++ hello.cpp". Maybe I'm being naive, but I
would expect that if iostream.h exists, them it would work the same
way it always did. This seems to be a library problem. The error
message I get is

/var/tmp//cclCiboS.o: In function `main':
/var/tmp//cclCiboS.o(.text+0x4): undefined reference to `cout'
/var/tmp//cclCiboS.o(.text+0x8): undefined reference to `cout'
/var/tmp//cclCiboS.o(.text+0x14): undefined reference to `ostream::operator<<(char const*)'

Any thoughts anyone?

Thanks,
Lloyd