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.
Read More:
- Vs2017 C + + cannot open source file: “sdkddkver. H”, “stdio. H”, “TCHAR. H”
- Vs cannot open source file “XXX. H” problem
- Win10 vs 2017 prompt cannot open include file: “windows. H”: no such file or director
- Vs compiling OpenGL project, the solution of unable to open the source file “GL / glaux. H” appears
- Vs2017 cannot open the source file “XXX. H” by adding a file name after creating a new class
- Solution of unable to open source file “StdAfx. H” in vs2013 / 2012
- Vs error prompt: “unable to open source file XXXX. H” possible reasons and Solutions
- After the installation of vs2017, we can’t find the source files such as windows. H, stdio. H, etc
- How to solve the problem of “unable to open source file XXXXX. H” in VS development?
- Error in header file when calling OpenGL to open obj file in vs2013: unable to open include file: “GL / glut. H”: no such file or directories
- VS2010 compiler can’t open include file: “GL / glaux. H”: no such file or directory
- In VS2010, the compiler cannot open the file “GL / glaux. H”: no such file or directory
- Vs + QT reports an error “vs cannot open the source file qchartview”
- Unable to open source file in vs
- Solution of VS2008 unable to open GL / glaux. H header file
- Solution of vs unable to open source file and link library file
- Vs fatal error C1083: unable to open include file: “sys / socket. H”: no such file
- IntelliSense in VC + + 2010: unable to open source file “StdAfx. H”
- Vs2015 cannot open the file string. H, etc
- Vs2019 OpenGL glut: error: unable to open include file: ‘GL / glut. H’: no such file or directory