gcc pathing problem?

Colin Watson cjwatson at ubuntu.com
Wed Jun 15 12:41:06 UTC 2005


On Wed, Jun 15, 2005 at 06:57:19AM -0500, Ben Miller wrote:
> Code sample -as you can see, it's definitely learning material:
> #include <iostream.h>
> 
> int main() 
> {
> // cout << "The size of an int is: \t\t"  <<  sizeof(int)  << "bytes\n";
>  cout << "The size of a short\t\t"   <<  sizeof(short) << "bytes\n";
>  cout << "The size of a long is: \t\t"  <<  sizeof(long)<<  "bytes\n";
>  cout << "The size of a char is: \t\t"  <<  sizeof(char) << "bytes\n";
>  cout << "The size of a float is: \t\t" <<  sizeof(float) << "bytes\n";
>  cout << "The size of a double is: \t\t" <<  sizeof(double) << "bytes\n";
> 
>  return 0;
> 
> }

The new C++ standard says that cout shouldn't be in the main namespace
by default. Either use std::cout (preferable) or write 'using namespace
std;' at the top.

Cheers,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list