You Are Here:
TopDanceLine Dance > Line Dance Msg36753

Line Dance

Newbie confused by the mutual header dependency dance
Date: 9 Jun 2003 17:16:35 -0700
Newsgroups: comp.lang.c++
Size: 1,286 bytes
Hello, all.
In my efforts to better learn c++, I've come across a problem with
mutual header dependencies. I've looked over some past postings to
this group, but still haven't figured it out.
Basically, I have two header files involved.
Panel.h: #include "PanelContainer.h" ... class Panel : public PanelContainer { ... }
PanelContainer.h: #include "Panel.h" #include <vector> class PanelContainer { ... protected: std::vector<Panel*> children; // line 31 ... }
Now if I try to just compile things like this, I get the expected
dependency badness:
In file included from Panel.h:19, from Panel.cpp:17:
PanelContainer.h:31: `Panel' was not declared in this scope
So I added forward declarations of each class to the other's header
file.
I.e., Panel.h now starts: class PanelContainer; clas Panel : public PanelContainer { //line 28 ...
and PanelContainer.h starts: class Panel; class PanelContainer { ...
But now I get his error:
In file included from PanelContainer.h:19, from Screen.h:19, // Some other file from Screen.cpp:17:
Panel.h:28: base class `PanelContainer' has incomplete type
And I'm not entirely sure where to go from here. Any suggestions
would be appreciated.
Thanks in advance,
Max

Site Categories:
• Broadway
• Child Song
• Christian Music
• Classical Music
• Country Music
• Dance
• Gospel Music
• Guitar Music
• Jazz
• Karaoke
• Lyric
• Metal Music
• Music
• Music Download
• Music Video
• New Age
• Rap Music
• Reggae
• Rock
• Wedding Song
• World Music