gpt4 book ai didi

compiler-errors - `yyerror'的多重定义

转载 作者:行者123 更新时间:2023-12-02 10:47:19 24 4
gpt4 key购买 nike

使用 Bison(或 yacc)我如何解决错误

 multiple definition of `yyerror'

我试过 %option noyywrap nodefault yylineno并在顶部编写原型(prototype)。没运气。

-编辑-

没关系。当我复制粘贴一个示例以使用时,我没有意识到我已经有一个 yyerror 函数。

最佳答案

您需要以下 ld(1)选项:

    -y symbol
--trace-symbol=symbol
Print the name of each linked file in which symbol appears. This
option may be given any number of times. On many systems it is
necessary to prepend an underscore.

您可以通过 cc(1) 提供此信息前端通过 -Wl,option
   -Wl,option
Pass option as an option to the linker. If option contains commas,
it is split into multiple options at the commas.

所以, cc -Wl,--trace-symbol=yyerror ...

关于compiler-errors - `yyerror'的多重定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1550043/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com