【发布时间】:2017-04-10 04:22:12
【问题描述】:
我是 flex 和 bison 的新手,在我的 Mac 上,我使用这些在我的 Mac 上安装 flex 和 bison:
brew install flex && brew link flex --force
brew install bison && brew link bison --force
这是我的test1ll.l 文件
%{
#include <iostream>
using namespace std;
%}
%%
[0-9]+ { cout << "Number "; }
[a-zA-Z]+ { cout << "Word "; }
[ \t] ;
%%
然后我运行以下命令:
flex -otest1ll.c test1ll.l
g++ test1ll.c -otest1 -lfl
./test1
我收到了这些错误:
dyld: lazy symbol binding failed: Symbol not found: _yylex
Referenced from: /usr/local/opt/flex/lib/libfl.2.dylib
Expected in: flat namespace
dyld: Symbol not found: _yylex
Referenced from: /usr/local/opt/flex/lib/libfl.2.dylib
Expected in: flat namespace
Abort trap: 6
有人可以解释一下并帮我解决吗?
【问题讨论】:
标签: c++ macos compiler-construction flex-lexer