Problems with string
Oscar Fuentes
ofv@wanadoo.es
Sun Nov 24 18:03:00 GMT 2002
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
More information about the Gcc-help
mailing list