implicit declaration of function usleep

That list is the pre-conditions for having usleep defined. It’s basically a C-like expression involving #define variables which has to be true before including the header file. The header file itself will only define usleep inside what is usually a massive nest of #ifdef statements and the developers have taken the time to tell you … Read more

c++, usleep() is obsolete, workarounds for Windows/MingW?

I used this code from (originally from here): #include <windows.h> void usleep(__int64 usec) { HANDLE timer; LARGE_INTEGER ft; ft.QuadPart = -(10*usec); // Convert to 100 nanosecond interval, negative value indicates relative time timer = CreateWaitableTimer(NULL, TRUE, NULL); SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); WaitForSingleObject(timer, INFINITE); CloseHandle(timer); } Note that SetWaitableTimer() uses “100 nanosecond intervals … … Read more