flex icon indicating copy to clipboard operation
flex copied to clipboard

How to compile examples/manual?

Open pengyu opened this issue 6 years ago • 0 comments

I see the following error when I try to make for examples/manual. Does anybody know what is the correct way to compile the examples?

$ for f in *.lex; do make -f Makefile.examples ${f%.lex}; done
flex -i -I   cat.lex
gcc -g   lex.yy.c -o cat -ll
flex -i -I   dates.lex
gcc -g   lex.yy.c -o dates -ll
make: *** No rule to make target 'eof_rules'.  Stop.
make: 'expr' is up to date.
make: 'front' is up to date.
make: *** No rule to make target 'j2t'.  Stop.
make: 'myname' is up to date.
flex -i -I   myname2.lex
gcc -g   lex.yy.c -o myname2 -ll
flex -i -I   numbers.lex
gcc -g   lex.yy.c -o numbers
numbers.lex:93:50: warning: format specifies type 'double *' but the
argument has type 'long double *' [-Wformat]
                             sscanf(yytext,"%lf",&yylval.ylong_double);
                                            ~~~  ^~~~~~~~~~~~~~~~~~~~
                                            %Lf
numbers.lex:101:50: warning: format specifies type 'double *' but the
argument has type 'long double *' [-Wformat]
                             sscanf(yytext,"%lf",&yylval.ylong_double);
                                            ~~~  ^~~~~~~~~~~~~~~~~~~~
                                            %Lf
numbers.lex:131:41: warning: format specifies type 'double' but the
argument has type 'long double' [-Wformat]
       printf("Value of number : %lf\n",yylval.ylong_double);
                                 ~~~    ^~~~~~~~~~~~~~~~~~~
                                 %Lf
3 warnings generated.
Undefined symbols for architecture x86_64:
  "_yywrap", referenced from:
      _yylex in lex-514b17.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile.examples:37: numbers] Error 1
make: *** No rule to make target 'pas_include'.  Stop.
make: *** No rule to make target 'pascal'.  Stop.
make: *** No rule to make target 'reject'.  Stop.
flex -i -I   replace.lex
replace.lex:18: warning, rule cannot be matched
gcc -g   lex.yy.c -o replace -ll
flex -i -I   string1.lex
gcc -g   lex.yy.c -o string1 -ll
string1.lex:7:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
1 error generated.
make: *** [Makefile.examples:49: string1] Error 1
flex -i -I   string2.lex
gcc -g   lex.yy.c -o string2 -ll
string2.lex:8:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
1 error generated.
make: *** [Makefile.examples:53: string2] Error 1
make: *** No rule to make target 'unput'.  Stop.
flex -i -I   user_act.lex
gcc -g -o user_act lex.yy.c -ll
make: *** No rule to make target 'userinit'.  Stop.
flex -i -I   wc.lex
gcc -g   lex.yy.c -o wc -ll
make: 'yymore' is up to date.
make: *** No rule to make target 'yymore2'.  Stop.

pengyu avatar Feb 08 '19 21:02 pengyu