I am trying to use the fork()
and wait()
system calls in C++.
My code is really simple. However I get the following error:
error C3861: 'fork': identifier not found
I have included the following header files. Do I have to include some other headers here? What is it that I am doing wrong?
#include<stdafx.h>
#include <sys/types.h>
#include <signal.h>
int main(){
if(fork()==0)
{
printf("from child");
}
else
{
printf("from parent");
}
}