Well, this must be a silly one. Here below is a can-not-be-simpler code in C. It can not compile saying “undefined reference to sleep”. But I think I include all system header I need…
#include <stdio.h>
#include <unistd.h>
int main()
{
printf("Test starts.\n");
sleep(1);
printf("Test ends.\n");
return 1;
}
Try this at the top:
This code will allow you to use two different functions under the same name, that do quite the same thing. And it compiles under different platforms.
Also, parenthesizing the
(x)argument ensures that the delay is right even if someone calls it like thissleep(10+10)