使用 Visual Studio 2015 進行程序開發工作時,如果編譯的是來自於Linux平台的源文件,該源文件可能會包含頭文件 uninstd.h,這樣會產生報錯信息:
"fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory"
解決辦法:
在VS的安裝目錄下找到 "VC\include" 文件夾,在其中創建一個 uninstd.h 文件,內容如下:
#ifndef _UNISTD_H
#define _UNISTD_H
#include <io.h>
#include <process.h>
#endif
這樣VS就會包含該頭文件並可以調用所需的函數了。