To include the string class header simply 
#include <string>. Just tested it now.

On Monday 03 Feb 2003 8:52 am, Tim Wright wrote:
> oops, this should have gone to the list as well :)
>
> miT
>
> ---------- Forwarded message ----------
> Date: Mon, 3 Feb 2003 21:30:41 +1300 (NZDT)
> From: Tim Wright <[EMAIL PROTECTED]>
> To: Paul <[EMAIL PROTECTED]>
> Subject: Re: C++/gcc problems
>
> On Mon, 3 Feb 2003, Paul wrote:
> > I know C and am trying to learn C++, can someone please tell me why the
> > following program will not compile in Linux. I have tried using the
> > following. Also, does gcc support the ansii C++ string class? If so, how
> > do compile a program using it?
>
> Works fine for me, with a deprecated error message (see below). Your error
> messages indicate that <iostream.h> is not being included properly. I have
> no idea why. Try compiling with the "-Wall" switch (turn all warnings on).
>
> The c++ string library seems to be at /usr/include/g++-3/std/bastring.h on
> my system (Debian unstable). You probably need to go:
>
> #include <std/bastring.h>
>
> to include it. Don't know how to use it tho :(
>
>
>
>
> tnw13_l [/tmp]
> (-:g++ -Wall -ansi -pedantic cprog.cpp
> In file included from /usr/include/c++/3.2/backward/iostream.h:31,
>                  from cprog.cpp:2:
> /usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning
> This file includes at least one deprecated or antiquated header. Please
> consider using one of the 32 headers found in section 17.4.1.2 of the C++
> standard. Examples include substituting the <X> header for the <X.h>
> header for C++ includes, or <sstream> instead of the deprecated header
> <strstream.h>. To disable this warning use -Wno-deprecated.
>
> tnw13_l [/tmp]
> (-:./a.out
> a area: 2
> *b area: 12
> *c area: 2
> d[0] area: 30
> d[1] area: 56
>
>
> Tim Wright
>
> Assistant Lecturer
> Department of Computer Science
> University of Canterbury
>
> http://www.cosc.canterbury.ac.nz/~tnw13

Reply via email to