Hello Roman, > sys_stat.in.h includes <io.h> in order to get the _mkdir function > declaration. This works in MinGW, but MinGW-w64's io.h [1] doesn't declare > _mkdir, direct.h [2] does. OTOH, MinGW's direct.h [3] includes io.h [4], > where _mkdir is declared, so including <direct.h> will work there as well. > > Microsoft's documentation [5] also states that _mkdir is declared in > <direct.h> (albeit that's not for the runtime version MinGWs use).
Thanks for these pointers. I'm applying this presumed fix. 2010-04-10 Bruno Haible <[email protected]> mkdir: Make it work on mingw64. * lib/sys_stat.in.h: Include <direct.h> together with <io.h>. Reported by Roman Donchenko (Роман Донченко) <[email protected]>. --- lib/sys_stat.in.h.orig Sun Apr 11 00:24:55 2010 +++ lib/sys_stat.in.h Sun Apr 11 00:24:50 2010 @@ -56,7 +56,8 @@ /* Before doing "#define mkdir rpl_mkdir" below, we need to include all headers that may declare mkdir(). */ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# include <io.h> +# include <io.h> /* mingw32, mingw64 */ +# include <direct.h> /* mingw64 */ #endif #ifndef S_IFMT @@ -455,7 +456,8 @@ #else /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. Additionally, it declares _mkdir (and depending on compile flags, an - alias mkdir), only in the nonstandard <io.h>, which is included above. */ + alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, + which are included above. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ static inline int
