delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/24/14:10:52

From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using _String.h
Date: Thu, 24 Jun 1999 13:18:15 -0400
References: <3771FB88 DOT EF2E4586 AT unn DOT ac DOT uk>
X-Posted-Path-Was: not-for-mail
X-Accept-Language: en
X-ELN-Date: 24 Jun 1999 17:16:55 GMT
X-ELN-Insert-Date: Thu Jun 24 10:25:04 1999
Organization: Nocturnal Aviation
Lines: 100
Mime-Version: 1.0
NNTP-Posting-Host: 1cust145.tnt12.nyc3.da.uu.net
Message-ID: <37726857.9CBE4451@earthlink.net>
X-Mailer: Mozilla 4.6 [en] (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Mark Collinson wrote:
> 
> Greetings,
> 
> Does anybody know how to use the _String.h header file. I am trying to
> write the following:

You are using a deprecated header and library.  You must explicitly link
libgpp.a to use it:


#include <iostream>

#include <_String.h>    // requires -lgpp in command line
                        // This non-standard gcc extension predates
                        // the standard <string> and should be avoided
void use_nonstandard(void)
{

    String a;
    String b;
    String c;

    cout << "Using the non-standard gcc <String.h> functionality" << endl;
    a = "Hello World";
    b = ", Goodbye cruel World";
    c = a + b;
    cout << c << endl;
}


#include <string>    // this is the C++ standard header
void use_standard(void)
{
    string a;
    string b;
    string c;

    cout << "Using the C++ standard gcc <string> functionality" << endl;
    a = "Hello World";
    b = ", Goodbye cruel World";
    c = a + b;
    cout << c << endl;
}

int main()
{
    use_nonstandard();
    use_standard();
}





/* vi: set cindent ts=4 sw=4 et tw=72: */



> 
> #include <iostream.h>
> #include <_String.h>
> 
> int main() {
> String a;
> String b;
> String c;
> 
> a="Hello World";
> b=", Goodbye cruel World";
> c=a+b;
> cout << c << endl;
> 
> return 0;
> }
> 
> Unfortunately I always get a bombardment of errors like:
> 
> C:\mark\code>gxx -Wall -o test.exe test.cpp -lgpp
> c:/djgpp/tmp\cccygxwf(.text+0x1b):strtest.cpp: undefined reference to
> `String::String(void)'
> c:/djgpp/tmp\cccygxwf(.text+0x29):strtest.cpp: undefined reference to
> `String::~String(void)'
> c:/djgpp/tmp\cccygxwf(.text+0x53):strtest.cpp: undefined reference to
> `String::~String(void)'
> .
> .
> .
> 
> Any help would be gratefully recieved.
> 
> Cheers,
> Mark


-- 
Martin Ambuhl (mambuhl AT earthlink DOT net)

Ah! but it is something to have at least the 
choice of nightmares.  - Joseph Conrad

- Raw text -


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