title: static vs non-static variables in namespace
body: <p>I have a namespace <code>foo</code> which contains an integer <code>bar</code>, declared so...</p>
  
  <p>foo.h:</p>
  
  <pre><code>namespace foo {
      int bar;
  }
  </code></pre>
  
  <p>Now if I include <code>foo.h</code> in only one file, this works just fine. But a problem arises when I  include <code>foo.h</code> from two or more files: I get a linker error. I figured out that if I declare <code>bar</code> as <code>static</code>, I can include <code>foo.h</code> in more than one file. This seems strange to me, because I wasn't aware that one could declare a static variable inside of a namespace. (what does that even mean?)</p>
  
  <p>Why does this work? And more importantly, why <strong>doesn't</strong> it work <em>without</em> <code>static</code>? What does <code>static</code> mean when used in a <code>namespace</code>?</p>