在VC下如何使用头文件unistd.h

来源:互联网 发布:笔记本电脑怎么用淘宝 编辑:程序博客网 时间:2024/05/16 23:46
头文件unistd.h是Linux/Unix的系统调用,包含了许多UNIX系统服务函数原型,如open、read、write、_exit、getpid等函数。在linux下能够编译通过的包含此头文件的程序,在VC下编译时出现了如下问题

 fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

其实解决这个问题的方法并不难,只要在你的默认库文件夹下(我的电脑是D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\)添加一个unistd.h文件即可,其内容如下:

#ifndef _UNISTD_H
#define _UNISTD_H

#include <io.h>
#include <process.h>

#endif /* _UNISTD_H */

这样在重新编译包含unis.h的程序就能通过了。


引自:http://weilihero.blog.163.com/blog/static/13411039520109218831848/



原创粉丝点击