Tag Archives: vs linux

Vs cannot open the source file unistd. H under Windows

Many C programs developed under Linux require the header file unistd.h, but VC does not have a header file, so compiling with VC always returns an error. This can be solved by saving the following content as unistd.h under the visual stdio header file path.

My path is: C: Program Files (x86)\Microsoft VisualStudio\2017\Community\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 */

Unistd.h is a header file for Unix system-defined symbolic constants defined by the POSIX standard. It contains many prototype functions for UNIX system services, such as the read function, write function, and getpid function. H in UNIX is similar to Windows.h in Windows.