This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: g++ namespace std & BUG?
On Thu, Aug 23, 2001 at 09:48:16AM -0500, Mark Wall wrote:
> Hello! I was excited to successfully install gcc-3.0.1, but now I
> have compiling problems with many lines of old code. None of the STL
> functions like "cout" work without explicitly declaring "using namespace
> std;". I can live with that. PROBLEM: Other cstring functions do not
> work properly (e.g. "strcmp" do not return 0/1 when there is
> match/nomatch). Previous gcc versions compiled this correctly.
> Unfortunately my searches for a solution are futile.
>
> Please help.
>
> Mark Wall
Either use:
std::cout << "blah";
or
using std::cout;
// ...
cout << "blah";
It's bad coding style to do
using namespace std;
// ...
cout << "blah";
I prefer method one ;).
For the strcmp stuff, do:
#include <cstring> // C++ header equivalent to the C header string.h.
// ...
std::strcmp()
--
Carlo Wood <carlo@alinoe.com>