This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problems with string
- From: Oscar Fuentes <ofv at wanadoo dot es>
- To: gcc-help at gcc dot gnu dot org
- Cc: christian dot geisler at online dot de
- Date: 25 Nov 2002 03:03:26 +0100
- Subject: Re: Problems with string
- References: <1038179031.4565.11.camel@terra>
Christian Geisler <christian.geisler@online.de> writes:
> Hi,
> i'm using gcc-3.2 on my Linux-From-Scratch-System, which means, that i
> have really built everything from scratch (glibc-2.2.5, gcc-3.2 ...).
> I can't build any programs that use the string class (#include<string>).
> Are there some changings that i missed. I've read through some docs and
> faqs shipped with gcc-3.2 and found nothing about that.
> Building always stops with parsing errors and the error, that i'm using
> string as a type which isn't one. g++ thinks that i'm using an
> undeclared function.
> What can i do?
The Standard C++ Library names are on the 'std' namespace. GCC 3.x
honors that rule, GCC 2.x not.
Try this:
#include <string>
#include <iostream>
int main() {
std::string s = "hello world!";
std::cout << s << std::endl;
}
[snip]
--
Oscar