title: Problem when compiling C++ code with Xcode
body: <p>I was trying to compile some C++ code in Xcode and I got this error:</p>
  
  <pre><code>Undefined symbols:
    "Editorial::sm_nTotalEditorials", referenced from:
        Editorial::AskTotal()     in editorial.o
        Editorial::~Editorial()in editorial.o
        Editorial::~Editorial()in editorial.o
  </code></pre>
  
  <p>The list follows with two more entries for the destructor and four more entries for the constructor (which I believe are the only functions in which I use sm_nTotalEditorials). I attach the definition of the variable and the functions in which I use it.</p>
  
  <pre><code>class Editorial
  {
  private:
       static int         sm_nTotalEditorials;
       ...
  }
  
  int Editorial::AskTotal() {return sm_nTotalEditorials;}
  
  Editorial::~Editorial()
  {
      if (!m_pPrev) sm_pFirstEditorial=m_pNext;
      if (m_pPrev) (*m_pPrev).SetContext((*m_pPrev).AskPrev(),m_pNext);
      if (m_pNext) (*m_pNext).SetContext(m_pPrev,(*m_pNext).AskNext());
      sm_nTotalEditorials--;
  }
  </code></pre>
  
  <p>Then it prints similar error with the other 3 static private variables I'm using. I must be messing things up with static usage. This is my first C++ code, so I apologize for any bad syntax or if the question is too silly; I tried searching the internet but the error printed by Xcode is quite ambiguous and according to the tutorials I've seen, I'm using everything as it should be used. Also, the code is quite long to print all of it, and I pasted the parts where I think the mistake should be, but again I am not sure of that either.</p>