首页 > 解决方案 > unistd.h - 编译失败

问题描述

我在 VS 2015 和 Windows 10 中使用 Flex。我无法编译程序,出现以下错误:

cannot open source file "unistd.h"  
Cannot open include file: 'unistd.h': No such file or directory 

Here is the code section OF lex.yy.c file which this error relates to:

#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.
 */
#include <unistd.h>
#endif

我已经尝试了来自相同帖子的所有建议以寻求帮助。

当我添加 时%option nounistd,此错误消失,但随后出现另外两个错误:

Warning C4013   'isatty' undefined; assuming extern returning int   
Severity    Code    Description Project File    Line    Suppression State
Error   C4996   'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details. 

我只是无奈。

标签: visual-studio-2015flex-lexer

解决方案


推荐阅读