问题
I am trying to run a lexx and yacc program and I got the following error:
/usr/bin/ld: cannot find -ly
collect2: error: ld returned 1 exit status
Plz tell me which libraries am I supposed to add?
回答1:
I would guess the problem is that you're using a version of yacc other than the old AT&T yacc which doesn't come with liby (the -ly
you have). So you need to remove the -ly
option from your command line, and provide your own implementations of main
and yyerror
.
回答2:
What version of yacc and lex have the "-ly" parametr? I used this command in my university:
gcc gram.c gram.h sem.c -ly -ll or cc gram.c gram.h sem.c -ly -ll
And works! But on my home komputer doesn't work..
来源:https://stackoverflow.com/questions/18877798/cannot-find-ly-error