After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735137 - name "interface" conflicts with a define in MinGW's basetyps.h
name "interface" conflicts with a define in MinGW's basetyps.h
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: io
2.38.x
Other Windows
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2014-08-21 07:03 UTC by Elie Roux
Modified: 2014-08-27 14:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Elie Roux 2014-08-21 07:03:54 UTC
Compiling this file:

#include <basetyps.h> // invert the order to make it work
#include <giomm.h>

int main() {
   return 0;
}

fails with

In file included from test-giomm.cpp:1:0:
/home/eroux/softs/mxe/usr/i686-pc-mingw32.static/include/giomm-2.4/giomm/dbusmessage.h:353:94: error: expected ',' or '...' before 'struct'
   static Glib::RefPtr<Message> create_signal(const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& signal);
                                                                                              ^
/home/eroux/softs/mxe/usr/i686-pc-mingw32.static/include/giomm-2.4/giomm/dbusmessage.h:364:126: error: expected ',' or '...' before 'struct'
   static Glib::RefPtr<Message> create_method_call(const Glib::ustring& name, const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& method);
                                                                                                                              ^
/home/eroux/softs/mxe/usr/i686-pc-mingw32.static/include/giomm-2.4/giomm/dbusobject.h:228:77: error: expected ',' or '...' before 'struct'
   virtual void on_interface_added(const Glib::RefPtr<Gio::DBus::Interface>& interface);
                                                                             ^
/home/eroux/softs/mxe/usr/i686-pc-mingw32.static/include/giomm-2.4/giomm/dbusobject.h:230:79: error: expected ',' or '...' before 'struct'
   virtual void on_interface_removed(const Glib::RefPtr<Gio::DBus::Interface>& interface);

on Linux cross-compiling with MXE (but will certainly be the same under cygwin or Mingw32 under windows).

It is because "interface" is defined in basetyps.h, so gcc is unhappy to see it used in another way in dbusmessage.h.

Of course, a simple workaround in my case is to invert the two defines, but this is not always simple in big projects...

This was reported for gio here: 

https://bugzilla.gnome.org/show_bug.cgi?id=668071

and there is a fix here:

https://bug668071.bugzilla-attachments.gnome.org/attachment.cgi?id=205439

please apply it to giomm too!

Thank you,
Comment 1 Kjell Ahlstedt 2014-08-27 13:52:32 UTC
I have pushed the commit
https://git.gnome.org/browse/glibmm/commit/?id=fb0bf14a29b80a0843e1e5dd1b5c5345d3839c93
It changes 'interface' to 'iface' in Gio::DBus::Message and Gio::DBus::Object.
It's not equivalent to
https://bug668071.bugzilla-attachments.gnome.org/attachment.cgi?id=205439.
That patch changes 'interface' to 'iface' in GSocket. That was done before
g_socket_join_multicast_group() and g_socket_leave_multicast_group() were
wrapped in Gio::Socket.
The parameter name in GDBusMessage and GDBusObject is 'interface_'.
Comment 2 Elie Roux 2014-08-27 14:12:25 UTC
Thanks!