Christensen Tom, On Wednesday October 09, 2002 03:19, Christensen Tom wrote: > Ok, > I've been using Linux for about 1 year now, and 1 thing that has always > worked right out of the box is the gcc compiler... until now. > installed redhat 8.0 and it won't compile c++ programs... > not even hello world > > #include <iostream> > > int main() { > cout << "Hello World\n"; > return 0; > } > > when I compile that it says "undeclared function cout". > if I include iostream.h, it compiles successfully but complains because > iostream.h is deprecated. What gives? why's it broken? I've got iostream > in my usr/include/c++/3.2 directory it should work, but it doesn't.
It's not broken, it's been fixed. ;) The 3.2 version of GCC is VERY standards compliant and requires you to be as well. This especially means that namespaces are very important. This is a frequently overlooked part of the standard and means there is a ton of "broken" code, including the snippet above. You have two choices that will stop all your errors (and give you better code)... Sample 1 : #include <iostream> using namespace std; int main () { cout << "Hello World\n"; return 0; } or Sample 2 : #include <iostream> int main () { std::cout << "Hello World\n"; return 0; } When to use which is up to your needs. -- Brian Ashe CTO Dee-Web Software Services, LLC. [EMAIL PROTECTED] -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list