On Jan 2, 2008 6:45 AM, Jonathon Jongsma <[EMAIL PROTECTED]> wrote:

> On 1/2/08, David L <[EMAIL PROTECTED]> wrote:
> > Sorry if this is a stupid question, but how can I forward declare
> > gtkmm things so that gtkmm header files don't need to be
> > included before defining a class that has gtkmm pointers?
> >
> > For example, I'd like to get rid of the two includes in this header
> file:
> > // foo.h
> > #include <gtkmm/window.h>
> > #include <gtkmm/radioaction.h>
>
> namespace Gtk {
> class Window;
> class RadioAction;
> }
>
> > class foo {
> >  public:
> >   foo();
> >  private:
> >   Gtk::Window *myWindow;
> >   Glib::RefPtr<Gtk::RadioAction> myRadioAction;
> > };
>
> hope that helps


Thanks!  That did fix the Gtk::Window problem... now I get this error:

g++ -Wall -c -g  `pkg-config --cflags gtkmm-2.4` -o foo.o foo.cpp
foo.h:13: error: 'Glib' has not been declared
foo.h:13: error: ISO C++ forbids declaration of 'RefPtr' with no type
foo.h:13: error: expected ';' before '<' token
make: *** [foo.o] Error 1

But it works if I replace the original includes with:
#include <glibmm/refptr.h>

Is this the minimum set of header dependencies since
the compiler needs to know that a RefPtr is a pointer?
That header is 342 lines, which is a bit bigger than I'd
like.  Any way to avoid refptr.h inclusion?

Thanks,

                  David
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to