C++ and Eclipse project - how to work out what headers to include, and what class to forward declare
<p>I'm building a C++ project in Eclipse using a third party implementation of <code>gcc</code>. The makefile is auto-generated and the object rules are listed in alphabetical order ( I'm not sure if that's relevant ). </p>

<p>I can't seem to create the correct configuration of #include directives and forward declarations so that it compiles. I'm guessing - and its clearly a bad case of Voodoo Chicken Coding. Can someone tell me how I should work out the include order?</p>

<p>The problem is that the classes refer to each other (e.g. <code>Display</code> refers to <code>Texture2D</code> and vice versa ).</p>

<p>I have the following files:</p>

<pre><code> Display.cpp
 Display.h
</code></pre>

<p><code>Display.h</code> defines the following classes:</p>

<pre><code>class Canvas{ ... };
class Display
{
public:
   void PaintTexture(Texture2D * tex);
   void WriteText(BitmapFont * fnt);
private:
   Canvas * c;
};
</code></pre>

<p>and the files:</p>

<pre><code>Texture2D.h
Texture2D.cpp
</code></pre>

<p>Texture2D.h defines the following class:</p>

<pre><code>class Texture2D
{
    void PaintTo(Canvas * c);
};
</code></pre>

<p>and finally the files:</p>

<pre><code>BitmapFont.h
BitmapFont.cpp
</code></pre>

<p><code>BitmapFont</code> as defined in <code>BitmapFont.h</code> refers to both <code>Canvas</code> and <code>Texture2D</code>;</p>

<pre><code>class BitmapFont
{
public:
    void Paint(Canvas * c);
private:
    Texture2D * tex;
};
</code></pre>

<p><code>main.cpp</code> refers to <code>BitmapFont</code> and <code>Texture2D</code>.</p>
