Hi I am running this code on the visual studio 2022 .But it is saying #include <unistd.h>
cannot be opened. Basically it is c code which I am running in cpp environment.
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
int id;
id = fork();
if (id < 0) {
printf(" Error \n");
return (1);
}
else if (id == 0)
printf("Child\n");
else
printf("Parent \n");
return 0;
}
So i am confusing may be all c libraries are not included in cpp language. And in case i run this program in gcc this is saying fork in not defined???
I have tried to run this code on three compilers in dev cpp , visual studio 2022 and gcc but error have been thrown.