Similarly, I get this error on mingw in C++ mode: ../gllib/sys/ioctl.h:318: error: `ioctl' was not declared in this scope
and, once this is fixed: g++-3 -mno-cygwin -L/usr/local/mingw/lib -o test-sys_ioctl-c++.exe test-sys_ioctl-c++.o ../gllib/libgnu.a ../gllib/libgnu.a(ioctl.o): In function `ioctl': /home/bruno/testdir3/gllib/ioctl.c:65: undefined reference to `_ioctlsoc...@12' ../gllib/libgnu.a(ioctl.o): In function `ioctl': /home/bruno/testdir3/gllib/w32sock.h:34: undefined reference to `_wsagetlaster...@0' Here I'm solving the first problem. The second one is common to all sockets functions: - Why don't have modules 'accept' ... 'shutdown' not have a "Link: $(LIBSOCKET)" section? - Why don't the functions 'accept' ... 'shutdown' initialize the ws2_32 library upon first use? 2010-04-04 Bruno Haible <br...@clisp.org> ioctl: Fix C++ test error on mingw. * lib/ioctl.c (ioctl): Renamed from rpl_ioctl. * lib/sys_ioctl.in.h (ioctl): When SYS_IOCTL_H_HAVE_WINSOCK2_H is 1, use _GL_FUNCDECL_SYS, not _GL_FUNCDECL_RPL. --- lib/ioctl.c.orig Sun Apr 4 03:09:17 2010 +++ lib/ioctl.c Sun Apr 4 02:45:30 2010 @@ -50,7 +50,7 @@ # include "w32sock.h" int -rpl_ioctl (int fd, int req, ...) +ioctl (int fd, int req, ...) { void *buf; va_list args; --- lib/sys_ioctl.in.h.orig Sun Apr 4 03:09:17 2010 +++ lib/sys_ioctl.in.h Sun Apr 4 02:49:51 2010 @@ -44,7 +44,7 @@ /* Declare overridden functions. */ #if @GNULIB_IOCTL@ -# if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || @REPLACE_IOCTL@ +# if @REPLACE_IOCTL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef ioctl # define ioctl rpl_ioctl @@ -54,8 +54,10 @@ _GL_CXXALIAS_RPL (ioctl, int, (int fd, int request, ... /* {void *,char *} arg */)); # else +# if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1 _GL_FUNCDECL_SYS (ioctl, int, (int fd, int request, ... /* {void *,char *} arg */)); +# endif _GL_CXXALIAS_SYS (ioctl, int, (int fd, int request, ... /* {void *,char *} arg */)); # endif