MinGW is not designed to provide POSIX API on Win32.  It implements
native Win32 API (but there are some exceptions in libmingwex.a).
    i686-pc-mingw32-nm lib/libmingwex.a  | grep ' T '

You have couple choose:
1) use Sleep()
2) use Cygwin instead of MinGW
3) if you have glib2, use g_usleep().  GNOME/glib2 provide some
    level of portability between Linux and Win32 which I used as part
   of my development tools.


On 5/19/07, Charles Sullivan <cwsulliv@triad.rr.com> wrote:
I'm a newbie to MinGW, looking to compile a free-standing version of my
FOSS Linux C language program for Windows XP users.

My program builds and runs correctly so long as I omit a sleep()
function (which is critical to other parts of the program).

Here's a test program:
/* sleeptest.c */
#include < unistd.h>
int main ( void )
  return 0;

  gcc -Wall sleeptest.c -o sleeptest
yields the error message:
sleeptest.c: In function `main':
sleeptest.c:5: warning: implicit declaration of function `sleep'
C:\DOCUME~1\winuser\LOCALS~1\Temp/cceccaaa.o<.text+0x32>:sleeptest.c undefined reference to `sleep'
collect2: ld returned 1 exit status

I have downloaded and un-TAR'd the following MinGW binary packages into
directory c:\mingw

What else do I need to install to get the sleep() function?

Thanks for your help.

Charles Sullivan

This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
MinGW-users mailing list

You may change your MinGW Account Options or unsubscribe at: