GNOME Bugzilla – Bug 738551
'interface' variable conflicts with Windows defines
Last modified: 2014-11-02 14:41:28 UTC
Windows headers do "#define interface struct" which causes a conflict with the 'interface' variable name: In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/urlmon.h:7:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/ocidl.h:226, from /usr/i686-w64-mingw32/sys-root/mingw/include/naptypes.h:23, from /usr/i686-w64-mingw32/sys-root/mingw/include/ras.h:17, from /usr/i686-w64-mingw32/sys-root/mingw/include/mprapi.h:10, from /usr/i686-w64-mingw32/sys-root/mingw/include/iprtrmib.h:9, from /usr/i686-w64-mingw32/sys-root/mingw/include/iphlpapi.h:13, from /usr/i686-w64-mingw32/sys-root/mingw/include/glib-2.0/gio/gnetworking.h:35, from ../../libsoup/soup-address.c:14: ../../libsoup/soup-server.h:83:40: error: expected ';', ',' or ')' before 'struct' GSocketAddress *interface, ^ Makefile:870: recipe for target 'soup-address.lo' failed
Created attachment 288555 [details] [review] Fix build on Windows Avoid the use of 'interface' variable name in public headers to avoid conflicting with the "#define interface struct" that Windows headers do.
See also bug 656402, bug 696509, bug 692134 This was supposed to have been fixed by having "#undef interface" in gnetworking.h, but it appears to have gotten broken again with the addition of "include <iphlpapi.h>" last year. Does it break anything (anywhere in the stack) if you move the #undef to after that include?
Not sure -- in any case, renaming the GSocketAddress parameter in the .h file makes sense regardless of adding the #undef since it's called 'address' in the .c file and in the documentation there.
Comment on attachment 288555 [details] [review] Fix build on Windows ok, but don't close the bug. I want it around to remind me to fix gnetworking.h
Comment on attachment 288555 [details] [review] Fix build on Windows Attachment 288555 [details] pushed as a9c26b0 - Fix build on Windows
ok, fixed this in glib too. It still builds fine under mingw, so let's see if anyone complains about it breaking anything else...
Thanks Dan!