My Lex file main.l:
%{
#include <stdio.h>
%}
%%
start printf("Start command received\n");
stop printf("Stop command received\n");
%%
Create main.c file command:
> flex -Palone -omain.c main.l
Then try to compile it:
> gcc main.c -o main -lfl
and got the following errors:
"_alonewrap", referenced from:
_alonelex in ccdqmJjR.o
_input in ccdqmJjR.o
"_yylex", referenced from:
_main in libfl.a(libmain.o)
How to compile the lex program created with the prefix?
If you use prefix, libfl is not for you. You must provide your own
mainfunction and your own<prefix>wrapfunction (or say you don’t want one with%option noyywrap, see flex manual).