www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/07/08:36:41

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-Id: <200202071335.HAA24357@mailhub-1.iastate.edu>
To: djgpp AT delorie DOT com
From: Hayden Muhl <hmuhl AT iastate DOT edu>
Subject: Using strings in DJGPP
Date: Thu, 7 Feb 2002 07:35:07 -0600 (CST)
X-Mailer: Endymion MailMan Professional Edition v3.0.14 ISU Version mp5.42
Reply-To: djgpp AT delorie DOT com

I don't get this.  I have been trying to get DJGPP to work, but it does not 
like strings at all.  Here is my program.

#include <string.h>
#include <fstream.h>
#include <iostream.h>

int main()
{
string a = "Yo";
cout << a;
return 0;
}

and here is the error I get.

search.cpp: In function `int main()':
search.cpp:7: `string' undeclared (first use this function)
search.cpp:7: (Each undeclared identifier is reported only once for each
   function it appears in.)
search.cpp:7: parse error before `=' token
search.cpp:8: `a' undeclared (first use this function)

I have tried changing the line #include <string.h> to a ton of different stuff, 
but nothing works.  Here's a list of SOME of the the stuff I have tried.

#include <string>
#include <String.h>
#include <_String.h>
#include <cstring.h>
#include <basic_string.h>

I don't get it.  Did I get a bad version of the compiler?  Other header files 
work fine.  iostream and fstream work beautifully, but not string.  I just 
don't get it.




- Raw text -


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