i wrote a function to search if its parameter is in a given table obtab1.txt....the optab table has two columns out of which the parameter can only be in the first column..开发者_开发百科..in the aviasm.h file i wrote this code....
class aviasm
{
public:
aviasm(char *,char *);
~aviasm();
void crsymtab();
bool in1(string );
}
In the aviasm.cpp file i wrote...
bool aviasm::in1(string s)
{
ifstream in("optab1.txt",ios::in);//opening the optab1.txt
char c;
string x,y;
while((c=in.get())!=EOF)
{
in.putback(c);//putting back the charcter into stream
in>>x;//first field
in>>y;
if(x==s)
return true;
else
return false;
}
}
but i encountered several errors on compiling....
'bool aviasm::in1(std::string)' : overloaded member function not found in 'aviasm'
'aviasm::in1' : function does not take 1 arguments
'syntax error : identifier 'string'
...can anybody help??
It appears as though you are trying to use string without the proper declarations, you will need this at the top of your file:
#include <string>
using std::string;
精彩评论