Implicit declaration of function ‘wait’
You need to put:
#include <sys/types.h>
#include <sys/wait.h>
at the top of the program to get the declaration of the function.
This is shown in the man page
You are probably missing the headers for wait(2)
:
#include <sys/types.h>
#include <sys/wait.h>