This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with string


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]