title: How to use the same structure accross multiple source files?
body: <p>I have 3 source files: matrix.c, tetramino.c and learntris.c (which includes the headers <code>tetramino.h</code> and <code>matrix.h</code>, linking it with the respective files). I have a structure: <code>struct tetramino</code> that is need in all these files. After reading this question and its answers- <a href="https://stackoverflow.com/questions/3041797/how-to-use-a-defined-struct-from-another-source-file">How to use a defined struct from another source file?</a>, I created a header file <code>structure.h</code> and now my files look like this:</p>
  
  <p>In structure.h:</p>
  
  <pre><code>typedef struct tetramino  
  {
    int type;
    char *p;
  }tetramino;
  </code></pre>
  
  <p>In matrix.h:</p>
  
  <pre><code>#include"structure.h"
  int print_matrix(void);
  int clear_matrix(void);
  </code></pre>
  
  <p>In tetramino.h:</p>
  
  <pre><code>#include"structure.h"
  int rotate(void);
  int set_tetramino(void);
  </code></pre>
  
  <p>And finally, in the main learntris.c file contains:</p>
  
  <pre><code>#include"structure.h"
  #include"matrix.h"
  #include"tetramino.h"
  </code></pre>
  
  <p>Now, upon compiling them, I get these errors:</p>
  
  <blockquote>
    <p>error: redefinition of 'struct tetramino'</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>error: conflicting types for 'tetramino'</p>
  </blockquote>
  
  <p>Where is the problem?</p>