我正在使用bison&flex(通过cygwin下载)和vc ++.当我编译程序时,我收到一个错误:
...: fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
如果我在flex文件(.l)中定义YY_NO_UNISTD_H,则此错误将消失,但我还会收到其他几个错误:
...: error C2447: '{' …Run Code Online (Sandbox Code Playgroud)