<p>I have a couple of header files, which boil down to:</p>

<p>tree.h:</p>

<pre><code>#include "element.h"

typedef struct tree_
{
    struct *tree_ first_child;
    struct *tree_ next_sibling;
    int tag;
    element *obj;
    ....
} tree;
</code></pre>

<p>and element.h:</p>

<pre><code>#include "tree.h"

typedef struct element_
{
    tree *tree_parent;
    char *name;
    ...
} element;
</code></pre>

<p>The problem is that they both reference each other, so tree needs element to be included, and element needs tree to be included.</p>

<p>This doesn't work because to define the 'tree' structure, the element structure must be already known, but to define the element structure, the tree structure must be known.</p>

<p>How to resolve these types of loops (I think this may have something to do with 'forward declaration'?)?</p>

These are known as "once-only headers." See
http://developer.apple.com/DOCUMENTATION/DeveloperTools/gcc-4.0.1/cpp/Once_002dOnly-Headers.html#Once_002dOnly-Headers