well, i tried using <string.h> and <string> in my #includes. but i
have had no luck. below is the compile error and below that are my
header and implementation codes. i am just completely clueless as to
why 'string' is undeclared when i have a #include<string> in the
Parser.h file.
compile error:
g++ -c Parser.C
Parser.C: In member function `void Parser::command(std::istream&,
std::ostream&)':
Parser.C:61: `string' undeclared (first use this function)
Parser.C:61: (Each undeclared identifier is reported only once for each
function it appears in.)
Parser.C:61: parse error before `,' token
make: *** [Parser.o] Error 1
Parser.h:
#include<iostream.h>
#include<ctype.h>
#include<string>
class Parser
{
public:
void process(istream& inP, ostream& outP);
private:
void command(istream& inP, ostream& outP);
};
Parser.C:
#include"Parser.h"
void Parser::process(istream& inP, ostream& outP)
{
char ch;
while(inP.get(ch))
{
if(ch == '\\')
{
command(inP, outP);
}
else
{
outP << ch;
}
}
}
void Parser::command(istream& inP, ostream& outP)
{
char ch;
// eof while in command mode - print error and dump.
if(!inP.get(ch))
{
cerr << "oops...Didn't finish that command there did you?\n"
<< "tsk, tsk, tsk...Maybe next time, huh?" << endl;
return;
}
// Eat WS, otherwise move along.
while(isspace(ch))
{
inP.get(ch);
if(!isspace(ch))
{
inP.unget();
return;
}
}
// the def command.
if(isalnum(ch))
{
string name, // <--- this is line 61 compile error :
Parser.C:61: `string' undeclared
expansion;
}
// No cases, i guess we can go home.
outP << ch;
return;
}
thanks again for any help yall.
ryan
_______________________________________________
studentdev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/studentdev
Do not post admin requests to the list. They will be ignored.