Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

about iostream

kpc82kpc82 Member Posts: 1
hi,

when i compile a c++ code on RED HAT LINUX 8 using g++
and gcc the cout,cin objects of iostream header does
not get recognised it throws an error but when
i replace cout and cin with std::cout and std::cin
it work fine
how can(could) I rectify this ?

please mail me at
[chandra_82@indiatimes.com]
thank you

Comments

  • abcabc Member Posts: 443
    : hi,
    :
    : when i compile a c++ code on RED HAT LINUX 8 using g++
    : and gcc the cout,cin objects of iostream header does
    : not get recognised it throws an error but when
    : i replace cout and cin with std::cout and std::cin
    : it work fine
    : how can(could) I rectify this ?

    it's the normal, standard-conforming behavior - g++ 3.x treats the std namespace correctly (as opposed to 2.x that needed --fhonor-std).

    the usual namespace rules apply, meaning that you can do either [b]use std::cin; use std::cout;[/b] etc. or [b] use namespace std;[/b]
  • chgaychgay Member Posts: 4
    : : hi,
    : :
    : : when i compile a c++ code on RED HAT LINUX 8 using g++
    : : and gcc the cout,cin objects of iostream header does
    : : not get recognised it throws an error but when
    : : i replace cout and cin with std::cout and std::cin
    : : it work fine
    : : how can(could) I rectify this ?
    :
    : it's the normal, standard-conforming behavior - g++ 3.x treats the std namespace correctly (as opposed to 2.x that needed --fhonor-std).
    :
    : the usual namespace rules apply, meaning that you can do either [b]use std::cin; use std::cout;[/b] etc. or [b] use namespace std;[/b]
    :
    you can have
    #include
    or
    #include
    using namespace std;

    -Horace
Sign In or Register to comment.