|
From: Charles S. <cws...@tr...> - 2007-05-19 21:06:54
|
On Fri, 18 May 2007 09:30:05 -0700 Brian Dessent <br...@de...> wrote: > Charles Sullivan wrote: > > > What else do I need to install to get the sleep() function? > > You have a fundamental misunderstanding of MinGW's purpose if you expect > to port your software unchanged; if that is your goal, you should be > using Cygwin or something else. What MinGW provides is exactly the API > provided by the Microsoft C runtime (MSVCRT) and the Win32 API. sleep() > does not exist in either of those, so it failing to compile is the > expected behavior. > > All of this is documented fully on MSDN. For a list of all functions > provided by MSVCRT: > <http://msdn2.microsoft.com/en-us/library/634ca0c2(VS.80).aspx>. A > suitable replacement is the Win32 API function Sleep() (note the > capitalization difference) > <http://msdn2.microsoft.com/en-us/library/ms686298.aspx>. > > Also note that the footer of every Win32 API function tells you the > necessary header that must be included (in most cases, just #include > <windows.h>) and the libraries that must be linked. You can directly > translate the text "Use Kernel32.lib" to "add -lkernel32 to the link > command line." However, in this case, kernel32 is a pretty basic > library that every program links against (or alternatively put, > -lkernel32 is in the gcc specs file) so there's no need to manually add > it. But the more you use the Win32 API, be aware that some functions > will require nondefault libraries to be specified on the link command > line. > > Brian Thanks Brian. I've made a lot of changes to port the program to Windows XP, but I assumed that sleep() was a more-or-less standard library function. I see I was wrong. My program is a front end which executes another program. That being the case the simplest solution at present is to require the user to install the Windows Server 2003 Resource Kit Tools from the Microsoft website. This includes a sleep.exe function which I can execute as needed. Regards, Charles Sullivan |