Search code examples
gccyacclex

Fix: /usr/bin/ld: cannot find -ly collect2: error: ld returned 1 exit status


I can't compile yacc i lex:

$ cc gramatyka.c gramatyka.h semantyka.c -ly -ll 

output error:

/usr/bin/ld: cannot find -ly collect2: error: ld returned 1 exit status

How to fix it?


Solution

  • Most probably you are missing the -L path/to/dir/with/liby in your LDFLAGS (in case liby is in the same folder, just prepend -L. before -ly).