Lisa
Lisa

Reputation: 3181

flex auto generated file can't be used?

I'm using flex lexer as a lexer for my compiler project and I have this function to change the lexer input stream as follows:

.l

void initLexer(string code) {
    lineNumber = 1;
    columnNumber = 0;
    currentStringIndex = 0;
    yy_delete_buffer(YY_CURRENT_BUFFER);
    YY_BUFFER_STATE my_string_buffer = yy_scan_string("sh");
    yy_switch_to_buffer(my_string_buffer);
}

and I'm using the following options to generate the suitable routines

%option nounput 
%option nomain nodefault
%option noyywrap
%option warn
%option c++

after I run the flex lexer tool and I get the auto generated cpp file, I try to build my project but it can't recognize

error C2065: 'yy_current_buffer' : undeclared identifier    
error C3861: 'yy_delete_buffer': identifier not found   
error C3861: 'yy_scan_string': identifier not found 
error C3861: 'yy_switch_to_buffer': identifier not found    

Why?? What should I do??

Upvotes: 0

Views: 369

Answers (1)

artmind
artmind

Reputation: 11

My solution of this problem - i used flex from MinGW package

Upvotes: 1

Related Questions