title: redefinition of typedef
body: <p><i>I am possibly doing this incorrectly and this is much a question about why it works in one compiler and not the other.</i></p>
  
  <p>I have a large C application, and I am trying to follow the style of not including header files from within other header files. Instead, using forward declarations; thus I am trying the following.</p>
  
  <pre><code>// in A.h
  typedef struct A_ A;
  typedef struct B_ B;
  struct A_ {
      double a;
      B *b;
  };
  
  // in B.h
  typedef struct B_ B;
  struct B_ {
      int c;
  };
  
  // in C.h
  typedef struct A_ A;
  typedef struct B_ B;
  void function_do_something(A*, B*);
  
  // in C.c
  #include "A.h"
  #include "B.h"
  #include "C.h"
  void function_do_something(A* a, B* b) {
      ...
  }
  </code></pre>
  
  <p>This paradigm compiles and runs in Ubuntu 11.10 gcc -- but it gives compiler erros in OpenSUSE gcc that say "redefinition of typedef".</p>
  
  <p>I have been doing my development in Ubunutu and so hadn't realised that this paradigm might be incorrect. Is it just that this is plain wrong and Ubuntu's gcc is being too nice?</p>