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?

Was it helpful?

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, unlike fork(), 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
scroll top