(.text+0x12): undefined reference to `rpl_fprintf'
问题1:(.text+0x12): undefined reference to `rpl_fprintf'
解决办法:在yacc前面添加
%{
#undef yyerror
void yyerror (char *s);
%}
在第三部分添加:
void yyerror (char *s) {
fprintf ("%s\n", s);
}
可以解决问题,但是不能错误提示啦!
参看下面的说明之后就可以啦
5: Working around a bison bug
Normally, we'd rely on the bison run-time library to supply a main program, which would invoke the yyparse function and exit when it returned -- essentially, this code:
int main() { yyparse(); return EXIT_SUCCESS; }
To get this automatically, we'd add the -ly option at the end of the command invoking gcc to compile bison's output. As it happens, however, there is currently a bug in the bison library's implementation of the yyerror function, and gcc refuses to deal with it, issuing error messages that look like this:
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/liby.a(yyerror.o): In function `yyerror':
(.text+0x12): undefined reference to `rpl_fprintf'
collect2: error: ld returned 1 exit status
To work around this, we'll define our own main and yyerror functions. The main we need is the one shown above. yyerror is also elementary:
int yyerror (char const *message)
{
fputs(message, stderr);
fputc('\n', stderr);
return 0;
}
这个比较好!定义为最终解决办法!
Add these function definitions at the appropriate points in your lc.y file.
参看:
http://stackoverflow.com/questions/13073780/error-while-executing-c-file-developed-using-lex-and-yacc-tools
http://pubs.opengroup.org/onlinepubs/7908799/xcu/yacc.html
http://lists.gnu.org/archive/html/help-bison/2011-11/msg00000.html
(.text+0x12): undefined reference to `rpl_fprintf'的更多相关文章
- test.cpp:(.text+0xc0): undefined reference to `cv::imread(std::string const&, int)'
opencv报错: test.cpp:(.text+0xc0): undefined reference to `cv::imread(std::string const&, int)' te ...
- clang编译代码报错:`_start': (.text+0x24): undefined reference to `main'
1. 说明 使用clang++10.1编译报错: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crt1 ...
- 奇 arch/i386/kernel/head.o(.text+0x3e): undefined reference to `stack_start'
当linux/linkage.h 是dos格式保存,即以\r\n作行结束,gcc-2.96/redhat-7.3报错
- ompparticles.cpp:(.text+0x322): undefined reference to `omp_set_num_threads'
参考 http://www.code-by.org/viewtopic.php?f=54&t=163
- tmp/ccdLyHub.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status
其实就是一个问题,gcc只能编译.c文件,你如果取名为.cpp,那么gcc编译就会就会出现这个错误. 这种情况下: 1.用g++编译(.c 或.c++都可以编译) 2.仍用gcc编译,但是文件后缀改为 ...
- (.text+0x18): undefined reference to `main'
在将VS中的程序移植到ubuntu中出现的一个问题,主要原因是在vs中默认的主函数写成int _tmain(), 而在gcc编译时要找的是int main().改过来就可以了.
- gcc参数-l传递顺序错误导致`undefined reference'的一点小结
刚才编译一个pthread的单文件程序, 使用的命令行是: gcc -o thread1 -lpthread thread1.c 结果报错: $ gcc -o thread1 -lpthread th ...
- undefined reference to `switch_dev_unregister'
编译内核时,使用默认的配置进行编译.出现错误:undefined reference to switch_dev_unregister',undefined reference toswitch_se ...
- "undefined reference to" 问题解决方法 -链接问题
最近在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似下面这样的错误: (.text+0x13): undefined reference to `func' 关于unde ...
随机推荐
- python接口测试wsdl
一.wsdl接口怎样使用python测试 官网文档地址:https://fedorahosted.org/suds/wiki/Documentation 1.什么是wsdl接口,本质是xml,框架很多 ...
- cosine similarity
Cosine similarity is a measure of similarity between two non zero vectors of an inner product space ...
- python的编码判断_unicode_gbk/gb2312_utf8(附函数)
python中, 我们平常使用最多的三种编码为 gbk/gb2312, utf8 , unicode. 而python中并没有一个函数来进行 编码的判断.今天,主要对这三种编码进行讨论,并给出区分 ...
- (实用篇)php支付宝接口用法分析
本文实例讲述了php支付宝接口用法.分享给大家供大家参考.具体分析如下: 现在流行的网站支持平台,支付宝当仁不让的老大了,现在我们就来告诉你如何使用支付宝api来做第三方支付,把支付宝放到自己网站来, ...
- Javaweb学习随笔_JSP的九大内置对象
JSP内置对象整理 1. 九大内置对象: out,request,response,session,application,page,pageContext,config,Exception. 1.1 ...
- Sigar使用
Sigar(System Information Gatherer And Reporter),是一个开源的工具,提供了跨平台的系统信息收集的API,核心由C语言实现的.项目中使用Sigar进行服务器 ...
- apply 伴生对象 单例对象
apply(): 当类或者对象有一个主要用途时,apply方法提供了很好语法机制 scala> class Foo {} defined class Foo scala> object F ...
- python 后台爆破工具
sys:使用sys模块获得脚本的参数 queue模块,创建一个“队列”对象 time 模块 Python time time() 返回当前时间的时间戳(1970纪元后经过的浮点秒数). fin ...
- 最新AFNetworking
1.网络监测 /** * 网络检测 */ - (void)networkingMonitoring { //打开网络监测 [[AFNetworkReachabilityManager sharedMa ...
- js创建对象的四种方式
(1)对象字面量 var clock = { hour:12, minute: 10, second: 10, showTime: function(){ alert(this.hou ...