问题

途中使用的命令是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. ELK 教程

    自从ELK首次推出以来,下载量达到了数百万次,是世界上最流行的日志管理平台.相比之下,Splunk - 该领域的历史领先者 - 宣布的客户总数才15000人. 章节 ELK 介绍 ELK 安装Elas ...

  2. 动态添加,删除class样式

    function hasClass(obj, cls) { //class位于单词边界,判断class样式是否已经存在 return obj.className.match(new RegExp('( ...

  3. cf 187B.AlgoRace

    floyd...太神奇了(不会floyd(大雾)) 貌似floyd的外层k是保证最短路从起点逐渐向外扩展(而不是乱搞233) 所以在处理f[i][j]=min(f[i][j],f[i][k]+f[k] ...

  4. JS元素的左右移动

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. pip2 install protobuf==2.6.1

    [libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.5.0 of the Pr ...

  6. gogs 升级

    可以使用 go get -u github.com/gogs/gogs 来升级,但是因为网络原因,这种升级方式失败了.另外一种是在 github 或者 gitee 上面直接下载源码,然后解压到 $GO ...

  7. python中__str__与__repr__

    (1)背景 python中,对于类(自定义类)的实例对象的默认显示既没有太大用处,也不美观.比如: class adder: def __init__(self,value=0): self.data ...

  8. 实现VR直播的关键技术

    VR是多媒体技术发展的必然趋势,人们所使用的信息载体从最早的文字.图像,到音视频,再到用VR,将事物的描述表达推向了极致,充分满足了沉浸性.互动性和构想性三大要素的需求.随着5G的商业化运营,VR有望 ...

  9. input自动填入密码以后变成白色和黄色的解决办法

    问题描述: 1.谷歌自动输入账号密码以后颜色变成黄色: 解决办法: 加样式: input:-webkit-autofill { background: red !important; color: # ...

  10. 实盘交易哪些代码BUG产生严重亏损

    1.少写一个return,疯狂开平2900次,以爆仓结束 2.在上生产环境前,不小心误删除了一个“!”(我至今也不清楚为什么会误删了,晕),导致平仓逻辑一直不满足,不止损,让我损失惨重! 3.卖单变买 ...