From: http://hi.baidu.com/amwdi/item/bf2d61075b25a1dd73e6760b
undefined reference to "sleep"
#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:
#ifdef __unix__
# include <unistd.h>
#elif defined _WIN32
# include <windows.h>
#define sleep(x) Sleep(1000 * x)
#endif