Menu

#2254 undefined reference to `_mkgmtime' using i686-w64-mingw32-gcc

OTHER
closed
nobody
None
Bug
invalid
Unknown
False
2015-04-07
2015-04-07
No

Dear MinGW developers,

I'm trying to compile an application with MinGW as packaged with Cygwin:

  • mingw64-i686-gcc 4.8.3-1
  • mingw64-i686-binutils 2.24.0.3.85cf705-1
  • mingw64-i686-headers 3.3.0-1
  • mingw64-i686-runtime 3.3.0-1

The following simple test case:

#include <time.h>

int main()
{
    struct tm tm;
    _mkgmtime(&tm);
}

fails to compile with the following error:

$ i686-w64-mingw32-gcc -o test.exe test.c 
/tmp/ccOjOHdH.o:test.c:(.text+0x16): undefined reference to `_mkgmtime'
collect2: error: ld returned 1 exit status

As far as I can tell, I'm including the correct headers. I also tried the first sample application at https://msdn.microsoft.com/en-us/library/2093ets1.aspx, and it fails to link with the same error.

Interestingly, the 64-bit version of this compiler (x86_64-w64-mingw32-gcc) appears to work fine! I suspect there is a problem with the aliasing of symbols in time.h. I can see that there are inline redirections to _mkgmtime32/_mkgmtime64 which are only active if __CRT__NO_INLINE is not defined, but I can't figure out how to get it undefined. Compiling with -finline makes no difference to the error messages.

Thanks in advance for your help!

Cheers, Chris.

Discussion

  • Keith Marshall

    Keith Marshall - 2015-04-07

    The headers in question are not maintained by MinGW.org; this is not our bug.

     
  • Keith Marshall

    Keith Marshall - 2015-04-07
    • status: unread --> closed
    • Resolution: none --> invalid
     
MongoDB Logo MongoDB