Parent <--> Child and header files



Hi, 
I've got problem in including header files when I want to do a parent-
child relation to be remembered from child widget. 

What I've got is CMainWindow class that consists of CMainToolbar and
CMainStatus. On a toolbar there's a button. When it will be hit I want
the text to show up on a status bar. So I want to remember a parent
widget pointer in Toolbar, to get back to CMainWindow class, and from
there push the text to statusbar. 

In other words I want to call:

'm_parent->status_bar.push("text")'

form one of the toolbars methods. I hope the idea isn't very bad. If
there a simple method I will be glad to know.

What is the PROBLEM is that I can't include "mainwindow.hh" file in
"maintoolbar.hh" files because I get errors (very strange;/ - listing at
the bottom). In "mainwindow.hh" I've got of course "#include
"maintoolbar.hh" because toolbar is the part of mainwindow.

At the end, here's the a part of gcc output when it comes to compile
maintoolbar.cc:

<src>

In file included from maintoolbar.hh:28,
                 from maintoolbar.cc:24:
mainwindow.hh:46: error: syntax error before `;' token
In file included from /usr/include/gtkmm-2.4/gtkmm/stock.h:24,
                 from maintoolbar.cc:26:
/usr/include/gtkmm-2.4/gtkmm/stockitem.h:76: error: parse error before
`)'
   token
In file included from /usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:31,
                 from /usr/include/gtkmm-2.4/gtkmm/image.h:31,
                 from /usr/include/gtkmm-2.4/gtkmm/stock.h:27,
                 from maintoolbar.cc:26:
/usr/include/gdkmm-2.4/gdkmm/pixbufanimationiter.h:52: error: ISO C++
forbids
   declaration of `PixbufAnimationIter_Class' with no type
/usr/include/gdkmm-2.4/gdkmm/pixbufanimationiter.h:52: error: parse
error
   before `;' token
In file included from /usr/include/gtkmm-2.4/gtkmm/image.h:31,
                 from /usr/include/gtkmm-2.4/gtkmm/stock.h:27,
                 from maintoolbar.cc:26:
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:54: error: ISO C++
forbids
   declaration of `PixbufAnimation_Class' with no type
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:54: error: parse error
before `;
   ' token
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:105: error: `Pixbuf' was
not
   declared in this scope
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:105: error: template
argument 1
   is invalid
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:105: error: ISO C++
forbids
   declaration of `get_static_image' with no type
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:107: error:
`PixbufAnimationIter
   ' was not declared in this scope
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:107: error: template
argument 1
   is invalid
/usr/include/gdkmm-2.4/gdkmm/pixbufanimation.h:107: error: ISO C++
forbids
   declaration of `get_iter' with no type
In file included from /usr/include/gtkmm-2.4/gtkmm/stock.h:27,
                 from maintoolbar.cc:26:
/usr/include/gtkmm-2.4/gtkmm/image.h:70: error: `Value' is not a
template
/usr/include/gtkmm-2.4/gtkmm/image.h:73: error: can't make `value_type'
into a
   method -- not in a class
/usr/include/gtkmm-2.4/gtkmm/image.h:102: error: parse error before `{'
token
/usr/include/gtkmm-2.4/gtkmm/image.h:106: error: syntax error before `;'
token
/usr/include/gtkmm-2.4/gtkmm/image.h:111: error: destructors must be
member
   functions
/usr/include/gtkmm-2.4/gtkmm/image.h:111: error: virtual outside class
   declaration
/usr/include/gtkmm-2.4/gtkmm/image.h:115: error: parse error before
`private'
/usr/include/gtkmm-2.4/gtkmm/image.h:117: error: syntax error before `;'
token
/usr/include/gtkmm-2.4/gtkmm/image.h:120: error: parse error before `&'
token
/usr/include/gtkmm-2.4/gtkmm/image.h:120: error: ISO C++ forbids
declaration of
   `Image' with no type
/usr/include/gtkmm-2.4/gtkmm/image.h:121: error: syntax error before `&'
token
/usr/include/gtkmm-2.4/gtkmm/image.h:125: error: ISO C++ forbids
declaration of
   `Image' with no type
/usr/include/gtkmm-2.4/gtkmm/image.h:125: error: only declarations of
   constructors can be `explicit'
/usr/include/gtkmm-2.4/gtkmm/image.h:129: error: parse error before
`public'
/usr/include/gtkmm-2.4/gtkmm/image.h: In function `GtkImage* Gtk::gobj
()':
/usr/include/gtkmm-2.4/gtkmm/image.h:136: error: `gobject_' undeclared
(first
   use this function)
/usr/include/gtkmm-2.4/gtkmm/image.h:136: error: (Each undeclared
identifier is
   reported only once for each function it appears in.)
/usr/include/gtkmm-2.4/gtkmm/image.h: At global scope:
/usr/include/gtkmm-2.4/gtkmm/image.h:139: error: non-member function
`const
   GtkImage* Gtk::gobj()' cannot have `const' method qualifier
/usr/include/gtkmm-2.4/gtkmm/image.h: In function `const GtkImage*
Gtk::gobj()
   ':
/usr/include/gtkmm-2.4/gtkmm/image.h:139: error: new declaration `const
   GtkImage* Gtk::gobj()'
/usr/include/gtkmm-2.4/gtkmm/image.h:136: error: ambiguates old
declaration `
   GtkImage* Gtk::gobj()'
/usr/include/gtkmm-2.4/gtkmm/image.h: At global scope:
/usr/include/gtkmm-2.4/gtkmm/image.h:142: error: parse error before
`public'
/usr/include/gtkmm-2.4/gtkmm/image.h:157: error: ISO C++ forbids
declaration of
   `Image' with no type
/usr/include/gtkmm-2.4/gtkmm/image.h:157: error: only declarations of
   constructors can be `explicit'
/usr/include/gtkmm-2.4/gtkmm/image.h:158: error: ISO C++ forbids
declaration of
   `Image' with no type
/usr/include/gtkmm-2.4/gtkmm/image.h:158: error: only declarations of
   constructors can be `explicit'
/usr/include/gtkmm-2.4/gtkmm/image.h:159: error: ISO C++ forbids
declaration of
   `Image' with no type
/usr/include/gtkmm-2.4/gtkmm/image.h:159: error: only declarations of
   constructors can be `explicit'
/usr/include/gtkmm-2.4/gtkmm/image.h:160: error: ISO C++ forbids
declaration of
   `Image' with no type
/usr/include/gtkmm-2.4/gtkmm/image.h:160: error: only declarations of
   constructors can be `explicit'
/usr/include/gtkmm-2.4/gtkmm/image.h:161: error: type specifier omitted
for
   parameter `IconSize'
/usr/include/gtkmm-2.4/gtkmm/image.h:161: error: parse error before `)'
token
/usr/include/gtkmm-2.4/gtkmm/image.h:161: error: ISO C++ forbids
declaration of
etc.
</src>

In CMainWindow I've got a class the inherits from DrawingArea if this to
help.

mainwindow.hh:46: error: syntax error before `;' token

is related to line:

RLC::CMainToolbar m_MainToolbar_Upper;


I hope hope I've discrabe clearly my problem.

Thanks for any suggestions in advance.

vArDo





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]