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

Jonas Mellin jonas.mellin@ida.his.se
Mon May 27 00:23:00 GMT 2002



Jan_VAN_BELLE/BE/ALCATEL@ALCATEL wrote:

> 	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.

/Jonas


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list