delorie.com/archives/browse.cgi | search |
From: | Michael Schuster <schuster AT eev DOT e-technik DOT uni-erlangen DOT de> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: STRING problems! |
Date: | Wed, 29 Apr 1998 06:53:22 GMT |
Organization: | Regionales Rechenzentrum Erlangen, Germany |
Lines: | 38 |
Message-ID: | <19980429.6532273@seneca> |
References: | <35462A31 DOT 4E83C790 AT acpub DOT duke DOT edu> <3546360D DOT 7114 AT cs DOT com> <35464CC1 DOT 4E00589F AT acpub DOT duke DOT edu> |
NNTP-Posting-Host: | eev6.e-technik.uni-erlangen.de |
Mime-Version: | 1.0 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Hi Robert! You got 3 errors in your program below: 1. You have to include <_string.h>. <string.h> includes the standart C- String functions such as strcpy(), strcmp() etc. <_string.h> includes the C++ String class. 2. the name of the String class is „String“ and not „string“ 3. your String-object is „word“ and not „test“. therfore substitute cout<< test with cout<< word. 4. Compile with gxx test.cc (asuming you named your test prog test.cc > #include <iostream.h> > #include <string.h> > > int main() > { > string word = "test"; > cout << test << endl; > return 0; > } Here the „improved version“ #include <iostream.h> #include <_string.h> int main() { String word = "test"; cout << word << endl; return 0; } hope that helps. Michi
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |