undefined reference to `yywrap'
来源:互联网 发布:js得到当前时间 编辑:程序博客网 时间:2024/06/06 08:32
原因:flex版本>2.5.4时的一个不兼容动作
处理方法:
当调试出现 undefined reference to `yywrap'得时候解决办法。
%option noyywrap
或者是链接时候使用-lfl参数来使用fl库中得函数。
当然也可以自己添加一个yywrap函数。返回个1就行了。
更多原因说明:
As previously noted by another poster this is a problem with the flex version on your system. If you use a flex with a higher version than 2.5.4 you're out of luck, unless you patch the sources. The reason for this is that the people developing flex had the "interesting" idea of changing the way the lexer parses the language file.
The fix is to downgrade your flex or to patch cfg-lex.l with a %option field disabling yywarp. From the top of my head it should read:
%option noyywrap Or you define the options as follows (I think):%{ prototype functionname(parameters); %}
#define yywrap() 1
更好的办法是定义:
int yywrap()
{
return(1);
}
关于yywrap更详细的信息可以参考unix的lex manual
http://www.scit.wlv.ac.uk/cgi-bin/mansec?1+lex
int yywrap(void)
Called by yylex at end-of-file; the default yywrap
always will return 1. If the application requires
yylex to continue processing with another source of
input, then the application can include a function
yywrap, which associates another file with the exter-
nal variable FILE *yyin and will return a value of
zero.
或flex的参考手册(这个貌似更广泛一点):
http://www.gnu.org/software/flex/manual/html_mono/flex.html
When the scanner receives an end-of-file indication from YY_INPUT, it then checks the `yywrap()' function. If `yywrap()' returns false (zero), then it is assumed that the function has gone ahead and set up yyin to point to another input file, and scanning continues. If it returns true (non-zero), then the scanner terminates, returning 0 to its caller. Note that in either case, the start condition remains unchanged; it does notrevert to INITIAL.
If you do not supply your own version of `yywrap()', then you must either use `%option noyywrap' (in which case the scanner behaves as though `yywrap()' returned 1), or you must link with `-lfl' to obtain the default version of the routine, which always returns 1.
参考网址:http://stackoverflow.com/questions/1811125/undefined-reference-to-yywrap
- UNDEFINED REFERENCE TO `YYWRAP'
- undefined reference to `yywrap'
- 编译:splint 遇到的问题: undefined reference to `yywrap'
- undefined reference to 'floor'/undefined reference to `&
- undefined reference to 'floor'/undefined reference to
- undefined undefined reference to `nfq_open'
- undefined reference to 'pthread_create'
- undefined reference to `_Unwind_Resume'
- undefined reference to `__ctype_b'
- undefined reference to rpl_malloc
- undefined reference to '__ctype_b'
- undefined reference to `__assert_fail'
- undefined reference to 'pthread_create'
- undefined reference to `__aeabi_unwind_cpp_pr0'
- undefined reference to `cvCreate2DHMM
- undefined reference to 'getfilecon'
- undefined reference to `__gxx_personality_v0'
- undefined reference to 'pthread_create'
- delete
- Java 中的日历类(Calendar)常用属性、方法
- Android Studio 开发百度地图SDK应用
- 程序员必读经典书籍
- C++ 用libcurl库进行http通讯网络编程
- undefined reference to `yywrap'
- LaTeX技巧207:使用align环境输入多行公式的技巧
- Hibernate jar包
- openIM sdk 源码解读
- iOS---生成四位验证码
- lua string库
- 智力题---感觉好玩
- mysql启动时,提示/etc/my.cnf 被忽略的问题处理
- Oracle 用户解锁