C header file #ifndef #include error
<p>I'm trying to figure out, how to use C headers with #ifndef and #include.
Lets say I have these two header files:</p>

<p><strong>headerA.h:</strong></p>

<pre><code>#ifndef HEADERA_H
#define HEADERA_H

#include "headerB.h"

typedef int MyInt;
TFoo foo;
... some other structures from headerB.h ...

#endif
</code></pre>

<p><strong>headerB.h</strong></p>

<pre><code>#ifndef HEADERB_H
#define HEADERB_H

#include "headerA.h"

typedef struct foo{
    MyInt x;
} TFoo;

#endif
</code></pre>

<p><strong>headerA.c</strong></p>

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

... some code ...
</code></pre>

<p><strong>headerB.c</strong></p>

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

... some code ...
</code></pre>

<p>When compiling headerB.c, it says </p>

<pre><code>In file included from headerB.h,
                 from headerB.c:
headerA.h: error: unknown type name ‘MyInt’
</code></pre>

<p>I think, it's becouse when <strong>headerB.h</strong> is compiling, it defines <strong>HEADERB_H</strong> and then, when <strong>headerA.h</strong> wants to include <strong>headerB.h</strong>, the <code>#ifndef HEADERA_H</code> is false = skips including.</p>

<p>What is the best practice here? I just read, that best practice is to do all <code>#include</code> directives in header files, but in this situation it looks like a problem.</p>

<p>EDIT: Ok, sorry for misleading you. This is just and example from bigger project with more files.</p>