Re: stl + g++-3.2
On Tuesday 15 April 2003 03:07 am, Albert Cervera Areny wrote:
> Hi,
> I'm trying to compile a proogram I've developed using the
> standard string and vector classes and it does compile
> without problems using g++-2.95 but if I just change the
> links for g++ and gcc from 2.95 to 3.2 I get some errors as
> if string and vector classes where not defined. Should I add
> something to be able to compile it?
2.95 is very sloppy about the use of the namespace std. I think
it just makes it an alias for the global namespace. Because of
this, a lot of programs manage it wrong.
In 3.2, string, cout, and so on are in the std namespace. To
use it, you need to either prefix it, as in
"std::cout" or "std::string",
or add a "using" statement
"using namespace std".
Reply to: