compiling C++ 'Hello World' on sparc sun solaris with gcc-3.1

Jonas Mellin
Mon May 27 00:23:00 GMT 2002


> 	Hello all,
> 	Could someone help me with this one?
> When I try to compile a stupid hello world program, I get bunches of
> errors.
> This is not something related specially to GCC-3.1, I got the same prob
> with version 3.0.4 . The machine is a sparc-sun-solaris-2.6.
> Kind Regards,
> Jan
> PROGRAM: Hello World
> #include <iostream>

Either 'using namespace std;' or #include <iostream.h> (deprecated)

> int main () {
>    cout << "Hello World" << endl;

Or: 'std::cout << ...'

AFAIK, the correct way is to put the std:: before any symbol in the std 
namespace and not to state "using namespace std;". We should not use 
"iostream.h" in new programs, since it is part of the standard for 
backward compatibility.


Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list