Mail Archives: djgpp/2000/10/31/21:02:02
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 -