title: Why aren't my compile guards preventing multiple definition inclusions?
body: <p>I have a header file  x.h which is included by more than one *.c source files.
  This header file has some structure variables defined.</p>
  
  <p>I have put multiple inclusion prevention guard at the beginning of the header file as:</p>
  
  <pre><code>#ifndef X_H
  #define X_H
  ...
  ..
  //header file declarations and definitons.
  
  
  #endif//X_H
  </code></pre>
  
  <p>On building I get linker errors related to multiple definitions. I understand the problem.</p>
  
  <ol>
  <li><p>Won't a multiple inclusion prevention guard at the top of header file as I have, prevent multiple inclusions of the header file x.h and thereby avoid multiple definitions of the variables that are there in x.h?</p></li>
  <li><p><code>#pragma</code> once does not work on this particular compiler, so what is the solution? 
  Someone had posted <a href="https://stackoverflow.com/questions/223771/repeated-multiple-definition-errors-from-including-same-header-in-multiple-cpps#223798">this</a> answer to a similar question. It doesn't seem to work for me. How does this solution work?</p></li>
  </ol>