Weird linking problem
Weird linking problem
I have recently got MinGW and such to compile my projects on my new PC(running Vista)
I copied sdl into lib, and copied all those header files in include, so all of my projects, almost compile...
It says it has an undefined reference to sleep() which I am almost sure, is in there somewhere...so how the crap is it not!? isn't it part of LibC!?
if it's not in libc or whatnot then what lib is it in!?
I copied sdl into lib, and copied all those header files in include, so all of my projects, almost compile...
It says it has an undefined reference to sleep() which I am almost sure, is in there somewhere...so how the crap is it not!? isn't it part of LibC!?
if it's not in libc or whatnot then what lib is it in!?
Did it work with other versions of windows?
After a short google search: MS's C library (msvcrt.dll) doesn't provide a sleep() function. There is a _sleep() function, which is deprecated however, and a Sleep() function provided by the Win32 API. Sorry, it seems you have to provide a platform dependent wrapper for that function, or use a different C library on windows (such as cygwin's).
cheers
Joe
After a short google search: MS's C library (msvcrt.dll) doesn't provide a sleep() function. There is a _sleep() function, which is deprecated however, and a Sleep() function provided by the Win32 API. Sorry, it seems you have to provide a platform dependent wrapper for that function, or use a different C library on windows (such as cygwin's).
cheers
Joe
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Why would MinGW link to msvcrt.dll? Would it not provide its own port of the GNU C Library as other Compilers do? It seems very unlikely they would link to microsoft specific C Library. This would mean they could not provide static linkage without paying microsoft to ship the msvcrt.lib along with the MinGW package.JoeKayzA wrote:Did it work with other versions of windows?
After a short google search: MS's C library (msvcrt.dll) doesn't provide a sleep() function. There is a _sleep() function, which is deprecated however, and a Sleep() function provided by the Win32 API. Sorry, it seems you have to provide a platform dependent wrapper for that function, or use a different C library on windows (such as cygwin's).
cheers
Joe
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Because MinGW is not Cygwin.. MinGW is used to write native applications for Windows.. (Not provide a POSIX/Unix compatibility layer..)Tyler wrote:Why would MinGW link to msvcrt.dll? Would it not provide its own port of the GNU C Library as other Compilers do? It seems very unlikely they would link to microsoft specific C Library. This would mean they could not provide static linkage without paying microsoft to ship the msvcrt.lib along with the MinGW package.
A package called (w32api-3.8.tar.gz) is provided to interface with the Windows API.. header wrappers.. libraries etc.MinGW: import libraries and header files for use with GCC to build native Windows applications..
So Microsoft's msvcrt.lib is not included.. a Free library is.. Which pretty much just provides anything required for resulting binaries to use the included msvcrt.dll distributed with Windows.. (It includes a bunch of static .a libraries which are apparently just wrappers for the proprietary DLL's included with Windows..)
It's not a project like Cygwin which is trying to bring in support for functions found on POSIX complaint systems..
People should "Really" just use Unix-like systems already...
i don't know if you know that glibc works on linux because it has been ported to work on linux. But on windows, i don't think microsoft releases how the c library uses the kernel so yes you HAVE to linux to msvcrt.dll. Even cygwin has to eventually do this or it has to linux to some other windows dll
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
I didn't understand a word you said.. did you confuse Link/Linux a few times?iammisc wrote:i don't know if you know that glibc works on linux because it has been ported to work on linux. But on windows, i don't think microsoft releases how the c library uses the kernel so yes you HAVE to linux to msvcrt.dll. Even cygwin has to eventually do this or it has to linux to some other windows dll
I think you started to make a point that it has to use msvcrt because programs do not know how to use the System Call ABI... of course this would be impossible anyway as it is different for each version of windows. Then you seem to backtrack and realise that the Windows API could also be wrappered and basically make my point, MinGW can use it's own C Library not msvcrt. I am sure M$ wrap the Win32 API also.iammisc wrote:i don't know if you know that glibc works on linux because it has been ported to work on linux. But on windows, i don't think microsoft releases how the c library uses the kernel so yes you HAVE to linux to msvcrt.dll. Even cygwin has to eventually do this or it has to linux to some other windows dll
yes i did. i meant thisI didn't understand a word you said.. did you confuse Link/Linux a few times
i don't know if you know that glibc works on linux because it has been ported to work on linux. But on windows, i don't think microsoft releases how the c library uses the kernel so yes you HAVE to link to msvcrt.dll. Even cygwin has to eventually do this or it has to link to some other windows dll.
Sorry. i wrote this late at night.