问题

途中使用的命令是cl.exe,在执行命令的时候找不到对应的unistd.h文件。

unistd.hUnix系统的文件,因此,十有八九,使用的是Windows系统。下面的代码可以修复,但是如果修复了unistd.h,很大概率你还会有更多个*.h文件找不到。劝退。

解决

找到这个编译器所在的文件夹的include文件夹,并且unistd.h文件复制进去即可。可以新建一个文本文件,把名字和后缀名改为unistd.h。

#ifndef _UNISTD_H
#define _UNISTD_H 1 /* This is intended as a drop-in replacement for unistd.h on Windows.
* Please add functionality as neeeded.
* https://stackoverflow.com/a/826027/1202830
*/ #include <stdlib.h>
#include <io.h>
#include <getopt.h> /* getopt at: https://gist.github.com/ashelly/7776712 */
#include <process.h> /* for getpid() and the exec..() family */
#include <direct.h> /* for _getcwd() and _chdir() */ #define srandom srand
#define random rand /* Values for the second argument to access.
These may be OR'd together. */
#define R_OK 4 /* Test for read permission. */
#define W_OK 2 /* Test for write permission. */
//#define X_OK 1 /* execute permission - unsupported in windows*/
#define F_OK 0 /* Test for existence. */ #define access _access
#define dup2 _dup2
#define execve _execve
#define ftruncate _chsize
#define unlink _unlink
#define fileno _fileno
#define getcwd _getcwd
#define chdir _chdir
#define isatty _isatty
#define lseek _lseek
/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */ #ifdef _WIN64
#define ssize_t __int64
#else
#define ssize_t long
#endif #define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
/* should be in some equivalent to <sys/types.h> */
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t; #endif /* unistd.h */

Windows的通病

这样是不可行的,在许多情况下。原因是这个头文件是unix, standard的缩写,只有unix系统(Linux, Mac OS)才有。因此我们需要找到对应的Windows标准库,就是 io.h,把包含是unistd.h的地方,都替换成io.h即可。

Python 安装zbar-py时出现 无法打开包括文件: “unistd.h” no such file or directory的更多相关文章

  1. VS2012与VS2015同时安装用VS2012创建MFC程序时弹出编译错误”fatal error C1083: 无法打开包括文件:“mprapidef.h”: No such file or directory”的解决办法

    在WIndows 7操作系统上同时安装VS2012与VS2015并用VS2012创建MFC程序时弹出编译错误”fatal error C1083: 无法打开包括文件:“mprapidef.h”: No ...

  2. fatal error C1083: 无法打开包括文件:“qedit.h”: No such file or directory

    VS2010编译 DirectShow一些项目时遇到 错误:fatal error C1083: 无法打开包括文件:“qedit.h”: No such file or directory 解决方法: ...

  3. 无法打开包括文件:“SDKDDKVer.h”: No such file or directory

    在已经装有Visual Studio 2010的系统中,同时安装Visual Studio 2012,安装过程很顺利,但到使用VS2013时,却出问题了. 本文主要介绍:VS中新建工程编译时出现,“无 ...

  4. 【解决】 无法打开包括文件:“windows.h”: No such file or directory

    vs编译时错误: 无法打开包括文件:“windows.h”: No such file or directory 出现这种错误什么都不用配置(环境变量),最好办法是将VS安装在C盘,让开发工具自动包含 ...

  5. 无法打开包括文件:“windows.h”: No such file or directory

      VS2012 出现如下错误: 无法打开包括文件:"windows.h": No such file or directory   解决办法,将 C:\Program Files ...

  6. afx.h(78): fatal error C1083: 无法打开包括文件: “new.h”: No such file or directory

    vs2015新建mfc工程,编译错误: D:\program files (x86)\microsoft visual studio 14.0\vc\atlmfc\include\afx.h(78): ...

  7. fatal error C1083: 无法打开包括文件: “SDKDDKVer.h”: No such file or directory(转)

    fatal error C1083: 无法打开包括文件: “SDKDDKVer.h”: No such file or directory 解决办法:(Vs2013中) 项目--右键--属性--配置属 ...

  8. ObjectARX2012错误1 fatal error C1083: 无法打开包括文件:“arxHeaders.h”: No such file or directory; fatal error C1083: 无法打开包括文件:“map”: No such file or directory

    问题1:fatal error C1083: 无法打开包括文件:“arxHeaders.h”: No such file or directory: 解决办法:这个问题很明显,是因为没有在工程属性里包 ...

  9. VC++_错误 无法打开包括文件“glglut.h” No such file or directory 怎么办

    在网上看到类似的问题,查找资料找到了解决方案,现整理如下,有些更改,好让自己多些印象,附原文网址:http://blog.csdn.net/bigloomy/article/details/62265 ...

随机推荐

  1. web前端知识点

    一.CSS问题 1.flex布局 display:flex; 在父元素设置,子元素受弹性盒影响,默认排成一行,如果超出一行,按比例压缩 flex:1; 子元素设置,设置子元素如何分配父元素的空间,fl ...

  2. Unity UGUI优化整理

    看了不少UI优化方面的东西,还是记下来方便记忆,优化性能往往是在各种选择之间做出平衡(空间换时间,或者GPU换CPU,舍弃精度等). 主要优化点在减少Drawcall,减少Overdraw. Mask ...

  3. Java中的static关键字和new关键字作用介绍

    一.static关键字的作用 1.可以用于修改类的成员变量.代码块和类 通过static可以将类的成员声明为静态成员,静态的成员归属于整个类,而不是属于某个对象.无论通过类还是对象访问静态成员,操作的 ...

  4. Bulma CSS - 简介

    Bulma CSS框架教程 Bulma CSS – 简介 Bulma CSS – 开始 Bulma CSS – CSS类 Bulma CSS – 模块化 Bulma CSS – 响应式 Bulma是什 ...

  5. mysql第五篇 : MySQL 之 视图、触发器、存储过程、函数、事物与数据库锁

    第五篇 : MySQL 之 视图.触发器.存储过程.函数.事物与数据库锁 一.视图 视图是一个虚拟表(非真实存在的),其本质是‘根据SQL语句获取动态的数据集,并为其命名‘ ,用户使用时只需使用“名称 ...

  6. 将已有微信小程序转换为多端应用

    文档地址 https://nervjs.github.io/taro/

  7. mac允许“任何来源”下载的应用

    刚买的mac电脑,我们不止在App Store上下载,还会通过浏览器下载 有的时候需要下载一些破解的软件,这个时候安装会提示文件被破坏,很是头疼 不用着急,这是因为mac会判断app如果被破坏,就不允 ...

  8. 51nod 1103:N的倍数 抽屉原理

    1103 N的倍数 题目来源: Ural 1302 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题  收藏  关注 一个长度为N的数组A,从A中选出若干个数,使得这 ...

  9. POJ 2996:Help Me with the Game

    Help Me with the Game Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64 ...

  10. 史上最好用的idea激活方法

    最近idea老出现激活一段时间然后就让重新激活的情况,每次都网上搜索一大堆激活方法,各种网址被封,各种插件不能用.就通过朋友介绍搞到一种方式,目前对于2018版本和2019版本都能激活并且正常使用.不 ...