(.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 ...
随机推荐
- 测试markdown
总结 写内容:博客重要的是内容,如果要讲形式与技术,应该深入学习html,这不是我的重点. 专注:就是利用MD这个好机会,忘记格式,用最简约的美观,来反衬出思考的清晰,内容的价值性. 今天 既要美国式 ...
- [.NET] 自己实现任务池(模仿线程池)
线程池虽然好用,但限制也不少: (1)总觉得默认的 MaxThread 小了一点,每次使用都要手工调大= = (2)任务不能等待完成 (3)任务一旦加入不能取消,甚至不知道是正在排队/正在执行/执行完 ...
- capwap协议重点分析
一. CAPWAP概述 CAPWAP由两个部分组成:CAPWAP协议和无线BINDING协议. (1)CAPWAP协议是一个通用的隧道协议,完成AP发现AC等基本协议功能,和具体的无线接入技术 ...
- ios网络知识
http://www.cocoachina.com/bbs/read.php?tid-31300.html 启蒙内容 http://blog.csdn.net/nono_love_lilith/ar ...
- Day23_IO第五天
1.递归求5的阶乘 package com.heima.chario; public class Demo8_Digui { /** * @param args * 递归:方法自己调用自己 * 5! ...
- android修改debug keystore文件使之和正式keystore sha1一致
转自:http://blog.k-res.net/archives/1671.html Android应用开发接入各种SDK时会发现,有很多SDK是需要靠package name和keystore的指 ...
- iOS后台挂起程序 当程序到后台后,继续完成Long-Running Task 任务
我们知道,到我们程序从前台退到后台(安home)键后,将执行程序的委托方法. // 当应用程序掉到后台时,执行该方法 - (void)applicationDidEnterBackground:(UI ...
- 二叉树[C实现]
#include<stdio.h> #include<malloc.h> #include<iostream> //定义节点 typedef struct BiNo ...
- VS常用快捷键
智能提示:ctrl + J方法参数提示:ctrl + shift +空格智能标记(如:提示using.实现接口.抽象类等):ctrl + .执行测试:ctrl + R,T(当前上下文),ctrl + ...
- IOS 二维码的实现
1.首先导入Coreimage框架. //创建滤镜对象 CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator&quo ...