#1448 tempnam not declared under __STRICT_ANSI__

WSL
closed
nobody
None
invalid
User_Error
2013-01-30
2010-06-27
No

$ cat tempnam.c
#include <stdio.h>
void foo(void)
{
tempnam(NULL, NULL);
}
$ i686-mingw32-gcc -o tempnam.o -c tempnam.c -Werror=implicit-function-declaration -std=c99
tempnam.c: In function 'foo':
tempnam.c:4: error: implicit declaration of function 'tempnam'
$ cat tempnam.diff
--- /usr/i686-mingw32/include/stdio.h.orig 2010-06-27 14:30:24.000000000 -0300
+++ /usr/i686-mingw32/include/stdio.h 2010-06-27 14:32:24.000000000 -0300
@@ -186,6 +186,8 @@
_CRTIMP int __cdecl __MINGW_NOTHROW rmtmp(void);
_CRTIMP int __cdecl __MINGW_NOTHROW unlink (const char*);
#endif
+#else
+_CRTIMP char* __cdecl __MINGW_NOTHROW tempnam (const char*, const char*);
#endif /* __STRICT_ANSI__ */

_CRTIMP int __cdecl __MINGW_NOTHROW setvbuf (FILE*, char*, int, size_t);
$ sudo patch -p0 < tempnam.diff
patching file /usr/i686-mingw32/include/stdio.h
$ i686-mingw32-gcc -o tempnam.o -c tempnam.c -Werror=implicit-function-declaration -std=c99
$

Discussion

  • Earnie Boyd

    Earnie Boyd - 2012-10-23

    Use tmpnam() for ANSI compatibility.

     
  • Earnie Boyd

    Earnie Boyd - 2012-10-23
    • milestone: --> Aged_issue
    • status: open --> closed-out-of-date
     
  • Earnie Boyd

    Earnie Boyd - 2013-01-30
    • labels: mingw runtime (deprecated use WSL) -->
    • status: closed-out-of-date --> closed
    • resolution: --> invalid
    • category: --> User_Error
    • milestone: --> WSL
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks