unknown type name 'pid_t' because of using unistd.h
-
13-07-2021 - |
Question
I am getting this error: unknown type name 'pid_t'
. I think Build is failing due to commenting of a header file: unistd.h
. Since windows does not support unistd.h, i comment #include <unistd>
and the only use of this header is pid_t
so I am looking forward to add pid_t definition manually in Visual Studio based on this answer.
any help?
Solution
Windows does not have a fork()
function. You have the following options:
Rewrite the program to use
CreateProcess()
. But note that this is not a 1-to-1 replacement. It creates a new process that, unlikefork()
, is not a copy of the calling process.Use an environment that simulates the Unix API, for example Cygwin.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow