Re: Updating a legacy bison/yacc grammar file (HELP!)

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Hi Aryeh,

> Le 16 juin 2020 à 20:16, Aryeh Friedman <[email protected]> a écrit :
> 
> 
> That helped significantly but I still have a few more errors on linking now
> that compiling is done:
> 
> c++ -v -o unspecified/bin/fmtgen -rdynamic -g -L/usr/local/lib
> unspecified/fmtgen/parse.yacc.o unspecified/fmtgen/arglex.o
> unspecified/fmtgen/generator.o unspecified/fmtgen/generator/factory.o
> unspecified/fmtgen/generator/introsp_code.o
> unspecified/fmtgen/generator/introsp_incl.o
> unspecified/fmtgen/generator/orig_code.o
> unspecified/fmtgen/generator/orig_include.o
> unspecified/fmtgen/generator/pair.o unspecified/fmtgen/indent.o
> unspecified/fmtgen/lex.o unspecified/fmtgen/main.o
> ld: error: undefined symbol: yylex()
>>>> referenced by parse.yacc.cc:1324 (fmtgen/parse.yacc.cc:1324)
>>>>              unspecified/fmtgen/parse.yacc.o:(yyparse())
> c++: error: linker command failed with exit code 1 (use -v to see
> invocation)
> 
> In fmtgen/parse.y (which gets bisoned into fmt/parse.yacc.cc ... the
> original problem I reported was caused by some sed calls as described in
> the archived message you pointed me to) I have:
> 
> extern int yylex(void);

Without seeing anything about your build system, it's a bit hard to see problem.  You didn't say how you fixed the issue either: for instance did you use api.prefix?

The problem is probably that the name of the scanner is not the same in fmtgen/lex.o and fmtgen/parse.yacc.o.  So have a look at `nm  fmtgen/lex.o` to see what name was given to xxxlex, and help parse.yacc.o find it.

Cheers!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.