colinaaa / cs143

laboratory assignments of cs143-Compilers
The Unlicense
16 stars 4 forks source link

undefined reference to `yylex' #1

Open colinaaa opened 4 years ago

colinaaa commented 4 years ago

This problem is caused by c++ library virus c library. See here.

The solution is quite simple. Just link lexer with the static lc library.

Edit the Makefile where lexer is built:

LDFLAGS= -static

lexer: ${OBJS}
        ${CC} ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIB} -o lexer
younghojan commented 10 months ago

This problem is caused by c++ library virus c library. See here.

The solution is quite simple. Just link lexer with the static lc library.

Edit the Makefile where lexer is built:

LDFLAGS= -static

lexer: ${OBJS}
        ${CC} ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIB} -o lexer

thx! it works for me