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:
- Analysis of the causes of errors in G + + compilation “was not declared in this scope”“
- Error c2011: “a certain class”: redefinition of “class” type
- Error c2061: syntax error: identifier ‘this_ FILE’
- Error: redefinition of class XXX
- Error: global variable is ambiguous (conflict between using namespace STD and global variable)
- Solutions to several VTK compilation errors (vtk5.8 + VS2010)
- Error resolution: Error: redefinition of class xxx
- OpenGL development environment configuration [vs2017] + common problems
- How to solve fatal error C1010!
- Some small problems in using vs2017
- C++ —Return multiple values of different types
- Solution to the problem of vs2017 error report unable to open source file
- Exploring the streaming call of underscore
- C++ compiler prompt “undefined reference to…”[How to Fix]
- Module in linux driver_ platform_ Learning driver macro
- pthread_ Introduction and application of join function
- Codeblock configuring OpenGL
- Error c3861: identifier not found | identifier not found
- Expected unqualified ID before numeric constant
- Error resolution of ‘string’ does not name a type