title: Accessing static class variables in C++?
body: <p>Duplicate:<br>
  <strong><a href="https://stackoverflow.com/questions/272900/c-undefined-reference-to-static-class-member">C++: undefined reference to static class member</a></strong></p>
  
  <p>If I have a class/struct like this</p>
  
  <pre><code>// header file
  class Foo
  {
     public:
     static int bar;
     int baz;
     int adder();
  };
  
  // implementation
  int Foo::adder()
  {
     return baz + bar;
  }
  </code></pre>
  
  <p>This doesn't work. I get an "undefined reference to `Foo::bar'" error. How do I access static class variables in C++?</p>