When use generate lexer with flex and compile it as cplusplus file, you will get an error like this:

fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

But when compile as c file it will be no problem, if you see the generated c file , you will see:

#ifdef __cplusplus
#include <stdlib.h>
#include <unistd.h>

So if you want to use the lexer in cpp project and work with windows platform( unistd.h only exist in unix OS , not windows), you will hit this problem.