delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/31/20:30:10

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Need help - String Class (compiling/linking)
Date: Tue, 31 Oct 2000 23:08:56 GMT
Organization: always disorganized
Lines: 39
Message-ID: <39ff50ed.52358905@news.freeserve.net>
References: <8tndkb$pu7$1 AT slb1 DOT atl DOT mindspring DOT net>
NNTP-Posting-Host: modem-99.blue-angel.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 973033736 19753 62.136.234.99 (31 Oct 2000 23:08:56 GMT)
NNTP-Posting-Date: 31 Oct 2000 23:08:56 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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