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 640948 - Error including gtkmm/dialog.h without first including gtkmm/box.h
Error including gtkmm/dialog.h without first including gtkmm/box.h
Status: RESOLVED OBSOLETE
Product: gtkmm
Classification: Bindings
Component: general
2.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2011-01-30 16:13 UTC by Matteo Settenvini
Modified: 2013-08-29 13:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Matteo Settenvini 2011-01-30 16:13:11 UTC
Hello,

I have gtkmm-2.4 ver. 2.22.0, trying to compile a program of mine with -DGTK_DISABLE_DEPRECATED and -DGSEAL_ENABLE on Ubuntu Natty.

If in a compilation unit I try to include dialog.h without first including box.h (I'm picking headers I need one by one, not using gtkmm.h), compilation fails with:

-------------------------------------------------------------

In file included from /usr/include/gtkmm-2.4/gtkmm/dialog.h:30:0,
                 from ../src/graphical_preferences_editor.hh:28,
                 from ../src/graphical_preferences_editor.cc:24:
/usr/include/gtkmm-2.4/gtkmm/box.h:105:1: error: expected class-name before ‘{’ token
/usr/include/gtkmm-2.4/gtkmm/box.h:112:10: error: ‘_GtkBoxChild’ does not name a type
/usr/include/gtkmm-2.4/gtkmm/box.h:114:16: error: ‘_GtkBoxChild’ does not name a type
/usr/include/gtkmm-2.4/gtkmm/box.h: In member function ‘guint16 Gtk::Box_Helpers::Child::get_padding() const’:
/usr/include/gtkmm-2.4/gtkmm/box.h:118:55: error: ‘gobj’ was not declared in this scope
/usr/include/gtkmm-2.4/gtkmm/box.h: In member function ‘bool Gtk::Box_Helpers::Child::get_expand() const’:
/usr/include/gtkmm-2.4/gtkmm/box.h:119:55: error: ‘gobj’ was not declared in this scope
/usr/include/gtkmm-2.4/gtkmm/box.h: In member function ‘bool Gtk::Box_Helpers::Child::get_fill() const’:
/usr/include/gtkmm-2.4/gtkmm/box.h:120:55: error: ‘gobj’ was not declared in this scope
/usr/include/gtkmm-2.4/gtkmm/box.h: In member function ‘bool Gtk::Box_Helpers::Child::get_pack() const’:
/usr/include/gtkmm-2.4/gtkmm/box.h:121:55: error: ‘gobj’ was not declared in this scope
/usr/include/gtkmm-2.4/gtkmm/box.h: In member function ‘GtkBox* Gtk::Box_Helpers::Child::parent()’:
/usr/include/gtkmm-2.4/gtkmm/box.h:130:52: error: ‘gobj’ was not declared in this scope

-------------------------------------------------------------

Solution: add a #include <box.h> directive to dialog.h.
Comment 1 Murray Cumming 2011-02-01 10:19:21 UTC
Do you have this problem with gtkmm 2.23/24? (for instance, from the branch in git)? box.h seems to be almost the first thing included from dialog.h so I don't understand how this could happen.
Comment 2 Murray Cumming 2011-02-08 08:28:21 UTC
Please respond. I'd like to fix this if it's a real bug.
Comment 3 Murray Cumming 2011-02-21 12:07:26 UTC
I'm still interested.
Comment 4 Kjell Ahlstedt 2011-02-25 18:50:02 UTC
_GtkBoxChild is deprecated from 2.22, but it's still used in Gtk::Box.
This potential problem is handled in gtkmm/box.h by temporarily undefining
GTK_DISABLE_DEPRECATED before "#include <gtk/gtk.h>". But box.h is not the only
gtkmm header file that includes gtk/gtk.h. If graphical_preferences_editor.cc
or graphical_preferences_editor.hh in Matteo's program includes one of these
other files before they include dialog.h or box.h, then gtk/gtk.h will be
included with GTK_DISABLE_DEPRECATED defined, and _GtkBoxChild will not be
defined when gtkmm/box.h is included.

_GtkBoxChild has been removed in Gtk+ 3 and gtkmm 3.

Shouldn't you have defined GTKMM_DISABLE_DEPRECATED instead of
GTK_DISABLE_DEPRECATED? Or both of them? GTK_DISABLE_DEPRECATED will not
disable any gtkmm API.
Comment 5 Murray Cumming 2011-02-26 11:23:16 UTC
(In reply to comment #4)
> If graphical_preferences_editor.cc
> or graphical_preferences_editor.hh in Matteo's program includes one of these
> other files before they include dialog.h or box.h, then gtk/gtk.h will be
> included with GTK_DISABLE_DEPRECATED defined, and _GtkBoxChild will not be
> defined when gtkmm/box.h is included.

Matteo, do you include any GTK+ headers in your own code?
Comment 6 Kjell Ahlstedt 2011-02-27 12:29:16 UTC
Or do you include gtkmm/table.h or gtkmm/treeiter.h before box.h or dialog.h?
Or any file that includes gtkmm/treeiter.h?
table.h and treeiter.h include gtk/gtk.h, and many files include treeiter.h.
Comment 7 Kjell Ahlstedt 2012-09-28 12:08:54 UTC
_GtkBoxChild has been removed in gtkmm 3. In gtk+3 it's available only in
gtkbox.c. This can't be a problem in gtkmm 3.

Shall we keep such bugs as this one open? A bug only in gtkmm 2 that will
almost certainly never be fixed in gtkmm 2.
Comment 8 Matteo Settenvini 2013-08-29 13:36:25 UTC
Closing as obsolete.