相关疑难解决方法(0)

unistd.h在vc ++下编译bison&flex程序时的相关难度

我正在使用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)

cygwin bison visual-c++ flex-lexer

24
推荐指数
4
解决办法
3万
查看次数

标签 统计

bison ×1

cygwin ×1

flex-lexer ×1

visual-c++ ×1