delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/31/21:13:33

From: "Paul Cechner" <paul AT ibc DOT com DOT au DOT NOSPAM>
Newsgroups: comp.os.msdos.djgpp
References: <8tndkb$pu7$1 AT slb1 DOT atl DOT mindspring DOT net> <39ff50ed DOT 52358905 AT news DOT freeserve DOT net> <8tnnpk$61u$1 AT slb1 DOT atl DOT mindspring DOT net>
Subject: Re: Need help - String Class (compiling/linking)
Lines: 73
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <upKL5.97$V_4.4370@nsw.nnrp.telstra.net>
Date: Wed, 1 Nov 2000 09:35:01 +0800
NNTP-Posting-Host: 203.24.93.65
X-Complaints-To: abuse AT telstra DOT net
X-Trace: nsw.nnrp.telstra.net 973042394 203.24.93.65 (Wed, 01 Nov 2000 12:33:14 EST)
NNTP-Posting-Date: Wed, 01 Nov 2000 12:33:14 EST
Organization: Customer of Telstra Big Pond Direct
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

the class name is actually 'string' (note the lowercase 's'), not 'String'

--
note: spam resistant email

----------------------
Paul Cechner


Charlie Hall <chazhall AT extra DOT mindspring DOT com> wrote in message
news:8tnnpk$61u$1 AT slb1 DOT atl DOT mindspring DOT net...
> I tried what you suggested, and now I get the following error messages:
>
>     In function 'int main()':
>     'String' undeclared (first use this function)
>     parse error before '('
>
> By the way, I get the same errors when I run it directly from RHIDE.
>
> You mentioned that _String.h is just a DJGPP thing.  What is <string>?  Is
> it the "standard C++" string class header?
>
> Any thoughts?
>
> Thanks,
> Charlie
>
>
> Steamer <dontmailme AT iname DOT com> wrote in message
> news:39ff50ed DOT 52358905 AT news DOT freeserve DOT net...
> > Charlie Hall wrote:
> >
> > >I've successfully written and run programs that use <iostream.h>,
> >
> > <iostream.h> is non-standard, so it's better to use <iostream>.
> > (Remember, however, that this puts everything in namespace std.)
> >
> > >and I've just attempted to use the String class,
> > >which I assume is in <_String.h>.
> >
> > <_String.h> is just a DJGPP thing - what you want is <string>.
> >
> > > Here's my code:
> > >
> > >     // Program:  list.cpp
> > >     #include <_String.h>
> > >
> > >     int main()
> > >     {
> > >         String s1('a');
> > >         return 0;
> > >     }
> >
> > Try this:
> >
> >
> > #include <string>
> > using std::string;
> >
> > int main()
> > {
> >     string s1("a");
> >     return 0;
> > }
> >
> >
> > Compile like this:
> >
> >     gpp -Wall -O2 list.cpp -o list.exe
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019