問題
VS 無法打開源文件 unistd.h
參考:鏈接
方法
許多在Linux下開發的C程序都需要頭文件unistd.h,但VC中沒有個頭文件,所以用VC編譯總是報錯。把下面的內容保存為unistd.h,放在visual stdio頭文件路徑下,可以解決這個問題
unistd.h在unix中類似於window中的windows.h
放到該路徑:VS安裝目錄\VC\Tools\MSVC\14.16.27023\include
/** This file is part of the Mingw32 package. unistd.h maps (roughly) to io.h */ #ifndef _UNISTD_H #define _UNISTD_H #include <io.h> #include <process.h> #endif /* _UNISTD_H */
或者加到項目頭文件中