我的程序在 Linux 机器上运行良好,但是当我在 IBM 上编译时yy_scan_string
不起作用。我需要声明或定义yy_scan_string
吗?
File : "file.l"
%{
#nclude <iostream>
#include <cstring>
bool st = false;
%}
%%
.([.][fF][1-9][0-9][Kk])$ { st = true; }
. { st = false; }
%%
int main()
{
const char *fName = "check.f9k";
char *elem = new char[strlen(fName) + 1];
sprintf(elem, "%s\n", fName);
yy_scan_string(elem);
yylex();
std::cout<<"\n ST : "<<st<<"\n";
return 0;
}
int yywrap() { return 1; }
编译:
lex file.l
g++ -o outfile lex.yy.c -ll
lex.yy.c: In function 'int main()': lex.yy.c:131: error: 'yy_scan_string' was not declared in this scope
如何解决我的 IBM 机器上的这个错误?