I want to use YY_BUFFER_STATE yy_scan_string(const char *str)
and other functions like yyparse()
in my main.cpp
, I did things:
extern "C"{
extern YY_BUFFER_STATE yy_scan_string(const char *str);
}
But there is a error error:
YY_BUFFER_STATE' does not name a type`, then I did:
extern yy_buffer_state;
typedef yy_buffer_state *YY_BUFFER_STATE;
extern int yyparse();
extern YY_BUFFER_STATE yy_scan_buffer(char *, size_t);
But the same problem also, how to do it, thanks, really appreciate your help!!
Here is the main.cpp file. #include "main.h"
#include <string.h>
extern "C"{void scan_string(const char* str);}
int yyparse();
void test::getvalue(int& var)
{
if (var!=0)
std::cout<<"True"<<std::endl;
else
std::cout<<"False"<<std::endl;
}
int main(){
std::string str="T+F";
//how to send str as an Input to parse?
yyparse();
return 0;
}