我尝试在 Ubuntu 18.04 中编译 gdb 9.2,打印出以下错误。
make[2]: Entering directory '/home/ata/gdb-9.2/build/gdb'
CXX ada-exp.o
ada-exp.y: In function ‘int ada_parse(parser_state*)’:
ada-exp.y:736:15: error: ‘yyin’ was not declared in this scope
ada-exp.y:736:15: note: suggested alternative: ‘yylen’
ada-exp.y:736:3: error: ‘lexer_init’ was not declared in this scope
ada-exp.y:736:3: note: suggested alternative: ‘pex_init’
In file included from ada-exp.y:56:0:
在此之前gdb 10.1已编译成功。
我在网上搜索但找不到原因或解决方案。
可能是什么问题?
编辑1:我有gcc版本7.5.0
最佳答案
我也遇到了这个问题,这就是我解决它的方法:
ada-exp.y
包含文件 ada-lex.c
,其中包含函数 lexer_init
的定义。
但如果您最初没有安装 Flex,那么它可能会生成一个空的 ada-lex.c
(来自 ada-lex.l
)。即使您执行 make clean
,它也不会清除生成的 ada-lex.c
,即,在下一个编译命令时它也将保持为空。
因此,要修复此错误,您可以删除所有此类中间 .c
文件(在您的情况下,使用新的 .tar.gz
进行构建)并再次执行 make。
关于makefile - gdb编译问题yyin和lexer_init,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64661573/