Hi I'm learing Lex and yacc. I created the following lex program.
%{
#include <stdio.h>
%}
%%
[0123456789]+ printf("NUMBER\n");
[a-zA-Z][a-zA-Z0-9]* printf("WORD\n");
%%
I'm trying to run it using the following commands:
also tried cc lex.yy.c -o example1 -lfl
When I enter the second command form above, I get error:
D:\workdir\flexyacc\Test3>gcc lex.yy.c -o Test -lfl
C:\Dev-Cpp\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lfl
collect2: ld returned 1 exit status
I tried googling this error but no luck so far. Since I'm new in Lex programming, I'm not understanding how to fix this. Any help will be greatly appreciated. Thank so much in advance.
To compile the lex code, firstly you should have installed flex in your machine. If so , there will a file libfl.a. In my machine I've installed flex in 'C:\GnuWin32\lib'
gcc lex.yy.c -L"C:\GnuWin32\lib" -lfl