unknown type name 'pid_t' because of using unistd.h

11.5k Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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, unlike fork(), is not a copy of the calling process.

  • Use an environment that simulates the Unix API, for example Cygwin.