Reputation: 2161
I am testing and playing a bit with flex before I start using it for a real project, but I am facing sone issues.
I am working on Android using a Linux emulator named Termux. I've installed flex and clang executing respectively $ apt install flex
and $ apt install clang
.
I have noticed that if I write flex code for C, process it with $ flex filename
, and then compile it with $ gcc -lfl lex.yy.c
, everything compiles and the binary works perfectly.
But if I write flex code for C++ (i.e. using C++ only features), process it with $ flex -+ filename
and compile it with $ g++ -lfl lex.yy.cc
, during compilation an error pops out saying that a file FlexLexer.h
, included as
#include <FlexLexer.h>
was not found.
Why does this only happen when using C++? Since I actually need it for C++, how can I fix this issue, minding that I am working on Android using an emulator?
Upvotes: 1
Views: 2861
Reputation: 59
On some versions of Debian/Ubuntu (such as Ubuntu 18.04 "Bionic") you may need to install the fl-dev
package to get the FlexLexer.h
header file. You can always check what package provides a file using the search tool at https://packages.ubuntu.com/
sudo apt install libfl-dev
Upvotes: 3
Reputation: 2917
This was a bug in the flex
package in Termux and has now been fixed - run apt update && apt upgrade
to get the updated package which contains FlexLexer.h
.
Upvotes: 2