[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stl + g++-3.2



On Tue, 15 Apr 2003 11:22:17 -0600, Al Davis <ad18@freeelectron.net> wrote:
> On Tuesday 15 April 2003 03:07 am, Albert Cervera Areny wrote:
>> Hi,
>> I'm trying to compile a program 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".

Or 

using std::cout;

as a compromise between the two (which is what I personally use).

                                                    Faheem.



Reply to: