title: Make: duplicate symbol
body: <p>I'm writing a c program. It contains following files:</p>
  
  <p>A.h</p>
  
  <pre><code>#pragma once
  extern int a;
  </code></pre>
  
  <p>A.c</p>
  
  <pre><code>int a = 1;
  </code></pre>
  
  <p>B.h</p>
  
  <pre><code>#pragma once
  #include "A.h"
  </code></pre>
  
  <p>B.c</p>
  
  <pre><code>#include "B.h"
  </code></pre>
  
  <p>And the makefile looks like that</p>
  
  <p>makefile:</p>
  
  <pre><code>objects = A.o B.o
  main : $(objects)
      cc -Wall -o main $(objects)
  </code></pre>
  
  <p>When I use 'make' command, there is error 'duplicate symbol _a in A.o B.o'. I searched for similar problems, but it seems that in all such problems, the key is that they didn't use the 'extern' key word. And I use it. What is wrong with my program?</p>