This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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




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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]