title: How to instantiate a static vector of object?
body: <p>I have a class A, which has a static vector of objects. The objects are of class B</p>
  
  <pre><code>class A {
    public:
      static void InstantiateVector();
    private:
      static vector&lt;B&gt; vector_of_B;
  }
  </code></pre>
  
  <p>In function InstantiateVector()</p>
  
  <pre><code>for (i=0; i &lt; 5; i++) {
    B b = B();
    vector&lt;B&gt;.push_back(b);
  }
  </code></pre>
  
  <p>But I have compilation error using visual studio 2008: unresolved external symbol...
  Is it possible to instantiate static vector using above method? For object b to be created, some data has to be read from input file, and stored as member variables of b</p>
  
  <p>Or it is not possible, and only simple static vector is possible? I read somewhere that to instantiate static vector, you must first define a const int a[] = {1,2,3}, and then copy a[] into vector</p>