问题现象:...: fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory 原因,flex生成的代码如下: #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ /* %if-c-only */ #include <unistd.h> /* %endif */ /* %if-c++-only */ /* %endif */ #endif 如果flex命令行调用加上 --nounistd 或者在词法描述文件中加上 %option nounistd,则可能产生如下错误: ...: error C2447: '{' : missing function header (old-style formal list?) ...: warning C4018: '<' : signed/unsigned mismatch ...: error C3