这是我的代码(仅为测试fork()而创建):
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
int pid;
pid=fork();
if (pid==0) {
printf("I am the child\n");
printf("my pid=%d\n", getpid());
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到以下警告:
warning: implicit declaration of function 'fork'
undefined reference to 'fork'
Run Code Online (Sandbox Code Playgroud)
这有什么问题?