title: typedef struct, circular dependency, forward definitions
body: <p>The problem I have is a circular dependency issue in C header files ...Having looked around I suspect the solution will have something to do with Forward Definitions, but although there are many similar problems listed, none seem to offer the information I require to resolve this one...</p>
  
  <p>I have the following 5 source files:</p>
  
  <pre><code>// fwd1.h
  #ifndef __FWD1_H
  #define __FWD1_H
  
  #include "fwd2.h"
  
  typedef
    struct Fwd1 {
      Fwd2  *f;
   }
  Fwd1;
  
  void  fwd1 (Fwd1 *f1,  Fwd2 *f2) ;
  
  #endif // __FWD1_H
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// fwd1.c
  #include "fwd1.h"
  #include "fwd2.h"
  void  fwd1 (Fwd1 *f1,  Fwd2 *f2)  { return; }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// fwd2.h
  #ifndef __FWD2_H
  #define __FWD2_H
  
  #include "fwd1.h"
  
  typedef
    struct Fwd2 {
      Fwd1  *f;
    }
  Fwd2;
  
  void  fwd2 (Fwd1 *f1,  Fwd2 *f2) ;
  
  #endif // __FWD2_H
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// fwd2.c
  #include "fwd1.h"
  #include "fwd2.h"
  void  fwd2 (Fwd1 *f1,  Fwd2 *f2)  { return; }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// fwdMain.c
  #include "fwd1.h"
  #include "fwd2.h"
  int  main (int argc, char** argv, char** env)
  {
    Fwd1  *f1 = (Fwd1*)0;
    Fwd2  *f2 = (Fwd2*)0;
  
    fwd1(f1, f2);
    fwd2(f1, f2);
  
    return 0;
  }
  </code></pre>
  
  <p>Which I am compiling with the command: <code>gcc fwdMain.c fwd1.c fwd2.c -o fwd -Wall</code></p>
  
  <p>I have tried several ideas to resolve the compile errors, but have only managed to replace the errors with other errors ...How do I resolve the circular dependency issue with the least changes to my code? ...Ideally, as a matter of coding style, I would like to avoid putting the word "struct" all over my code.</p>