help-gift
[Top][All Lists]
Advanced

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

Re: [help-GIFT] gcc-3.0.3


From: Andreas Enge
Subject: Re: [help-GIFT] gcc-3.0.3
Date: Tue, 8 Jan 2002 15:24:16 +0100 (CET)

Dear Wolfgang,

your simple example reminded me of a problem I encountered with a
different project. So here is the solution: The problem is due to the
namespaces newly introduced into g++. All the standard names reside in
the namespace "std". Both the following codes compile:

#include <string>
#include <iostream>
int main (){
  std::string x("hello");
  std::cout << x << std::endl << x+x << std::endl;
}

#include <string>
#include <iostream>
using namespace std;
int main (){
   string x("hello");
   cout << x << endl << x+x << endl;
}

Perhaps you could just add a line "using namespace std;" in some global
header file. Unless you reuse the standard names in a different context,
this should be fine.

Cheers,

Andreas


On Tue, 8 Jan 2002, Wolfgang Mueller wrote:
> #include <string>
> #include <iostream>
>
> main(){
>   string x("hello");
>   cout << x << endl << x+x << endl;
> }
>
> Fails miserably to compile:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]