MinGW is not designed to provide POSIX API on Win32.  It implements
native Win32 API (but there are some exceptions in libmingwex.a).
Check
   
    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.

Regards
KC

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 )
{
  sleep(5);
  return 0;
}
---------------

Running:
  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
  gcc-core-3.4.2-20040916-1.tar.gz
  mingw-runtime-3.9.tar.gz
  mingw-utils-0.3.tar.gz
  w32api-3.6.tar.gz
  binutils-2.15.91-20040904-1.tar.gz

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

Thanks for your help.

Regards,
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.
http://sourceforge.net/powerbar/db2/
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users