title: C++ How to declare and initialize a vector inside a class
body: <p>I would like to print out the vector "colors" using the member function "print". </p>
  
  <pre><code>/* Inside .h file */
  class Color
  {
  public:
      void print();
  
  private:
      std::vector&lt;std::string&gt; colors; = {"red", "green", "blue"};
  };
  
  /* Inside .cpp file */
  
  void Color::print() 
  { 
      cout &lt;&lt; colors &lt;&lt; endl;
  }
  </code></pre>
  
  <p>But I get an error message saying:</p>
  
  <pre><code>Implicit instantiation of undefined template.
  </code></pre>
  
  <p>at the declaration and initialization of vector "colors" inside class body</p>
  
  <p>And a warning:</p>
  
  <pre><code>In class initialization of non-static data member is a C++11 extension.
  </code></pre>