STL with gcc3

Matt Austern austern@apple.com
Wed Jul 17 16:20:00 GMT 2002


On Wednesday, July 17, 2002, at 11:35 AM, Ji Li wrote:

>
> Hello,
>
> 	I am experiencing some problem with STL when compile with gcc3. I
> have a little piece of c++ code like this:
>
> 	#include <iostream>
> 	#include <string>
>
> 	int main(){
> 	string aa = "Hello World !";
>
> 	cerr << aa << endl;
> 	}
>
> 	If I compile it with gcc-2.96, there is no problem. However, when
> I compile it with gcc-3.0.4, the compiler does not recognize neither
> 'string' nor 'cerr'. But if I add 'using namespace std;', gcc-3.0.4 
> works
> fine with it.
>
> 	I believe there must be a way to make gcc-3.0.4 backward
> compatable but just could find it. Would you please point the way for 
> me?

You really don't want to do that.  The standard says that everything
in the Standard Library is supposed to be in namespace std.  Other
compilers have conformed to the standard for years.  You should
change your code, for portability if for no other reason.

			--Matt



More information about the Gcc mailing list