manuzhang / decaf_compiler

13 stars 7 forks source link

pp1 cannot make #1

Closed AHEADer closed 7 years ago

AHEADer commented 8 years ago

well I start to write my own decaf compiler and I want to refer some codes from yours and CS143, but I failed to make in pp1, I only found some reasons, eg. library is libflex, which is -lfl not -ll in your Makefile, but there are some other problems that I cannot solve, I hope you can give me some suggestion

manuzhang commented 8 years ago

@AHEADer Sorry that I can't help more since this project was developed 5 years ago back in my college time and the environment no longer exists.

Could you post your error info here maybe I can look at together ?

AHEADer commented 7 years ago

in my archlinux, I use gcc 6.2.1, here's the error:

g++ -o dcc lex.yy.o errors.o utility.o main.o -lc -lm -lfl /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libfl.so: undefined reference to `yylex' collect2: error: ld returned 1 exit status make: *\ [Makefile:61: dcc] Error 1

AHEADer commented 7 years ago

well I just change "LIBS = -lc -lm -ll" to "LIBS = -lc -lm -lfl" in your pp1 directory

AHEADer commented 7 years ago

I have solved it, just change "-ll" to "-lfl" in your Makefile, and edit your scanner.h: change "int yylex();"to "extern "C" int yylex();", then all can be compiled, but I just don know why my laptop can compile successfully while my PC cannot....