title: static variable link error
body: <p>I'm writing C++ code on a mac. Why do I get this error when compiling?:</p>
  
  <blockquote>
    <p>Undefined symbols for architecture i386:   "Log::theString",
    referenced from:
          Log::method(std::string) in libTest.a(Log.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with
    exit code 1 (use -v to see invocation)</p>
  </blockquote>
  
  <p>Not sure if my code is wrong or I have to add additional flags to Xcode. My current XCode configurations are the default ones for a 'static library' project.</p>
  
  <p>My code:  </p>
  
  <p>Log.h------------</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  class Log{
  public:
      static void method(string arg);
  private:
      static string theString ;
  };
  </code></pre>
  
  <p>Log.cpp ----</p>
  
  <pre><code>#include "Log.h"
  #include &lt;ostream&gt;
  
  void Log::method(string arg){
      theString = "hola";
      cout   &lt;&lt; theString &lt;&lt; endl; 
  }
  </code></pre>
  
  <p>I'm calling the 'method' from a test code, in this way:
  'Log::method("asd"):'</p>
  
  <p>thanks for your help.</p>