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

头文件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的程序就能通过了

猜你喜欢

转载自blog.csdn.net/qq_35970739/article/details/81805313
今日推荐