title: C++ question... definition doesn't recognize vectors specified in declaration
body: <p>I'm working on a class assignment that started small, so I had it all in one file. Now it's gotten bigger and I'm trying to separately compile main, functions, and classes (so all the classes are together in one .h and one .cpp) I have one class B, which is the parent of a lot of others and comes first in the file. One of its data members isn't working now that I'm using separate compilation, which is causing dozens of errors. </p>
  
  <p>In .h</p>
  
  <pre><code>class A;
  class B {
  public: 
      B (){}
      A* myptr;
      void whatever();
      vector&lt;A*&gt; myAs; //this one is the problem
  };
  </code></pre>
  
  <p>In .cpp</p>
  
  <pre><code>void B::whatever() {
      vector&lt;A*&gt; newvector; //no problem!
      myptr = &amp;something; //no problem!
      for (vector&lt;A*&gt;::iterator iter = myAs.begin(); iter != myAs.end(); ++iter) {
          //error!
      }
  }
  </code></pre>
  
  <p>I get errors: either "myAs was not declared in this scope" or "class B has no member myAs." </p>
  
  <p>I've included &lt; vector >, forward-declared class A as you see above, and I definitely remembered to include the .h at the top of the .cpp! Is there something about vectors or classes and separate compilation that I don't understand? This is in Xcode, BTW.</p>