title: OpenCV undefined reference (FileStorage with vector<KeyPoint>)
body: <p>Been working with some OpenCV recently, however I have run across an interesting problem. I have a simple class to store data and read and write the data to a file.</p>
  
  <p>Here is the write function:</p>
  
  <pre><code>cv::Mat descriptors;
  vector&lt;cv::KeyPoint&gt; keypoints;
  
  void EventType::write(cv::FileStorage outfile) {
      outfile &lt;&lt; "descriptorId" &lt;&lt; descriptors;
      outfile &lt;&lt; "keypointId" &lt;&lt; keypoints;
  }
  </code></pre>
  
  <p>The issue arrises while linking:</p>
  
  <pre><code>EventType.cpp.o: In function cv::FileStorage&amp; cv::operator&lt;&lt; &lt;std::vector&lt;cv::KeyPoint,
      std::allocator&lt;cv::KeyPoint&gt; &gt; &gt;(cv::FileStorage&amp;, std::vector&lt;cv::KeyPoint,
      std::allocator&lt;cv::KeyPoint&gt; &gt; const&amp;)':
  EventType.cpp:(.text+0xc99): undefined reference to `cv::write(cv::FileStorage&amp;,
      std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;,
      std::vector&lt;cv::KeyPoint, std::allocator&lt;cv::KeyPoint&gt; &gt; const&amp;)'
  </code></pre>
  
  <p>However also when linking it suggests the following alternatives:</p>
  
  <pre><code>/opencv2/core/operations.hpp:2707: note: candidates are: void cv::write(cv::FileStorage&amp;, const std::string&amp;, int)
  /opencv2/core/operations.hpp:2708: note:                 void cv::write(cv::FileStorage&amp;, const std::string&amp;, float)
  /opencv2/core/operations.hpp:2709: note:                 void cv::write(cv::FileStorage&amp;, const std::string&amp;, double)
  /opencv2/core/operations.hpp:2710: note:                 void cv::write(cv::FileStorage&amp;, const std::string&amp;, const std::string&amp;)
  /opencv2/core/operations.hpp:2787: note:                 void cv::write(cv::FileStorage&amp;, const cv::Range&amp;)
  /opencv2/core/operations.hpp:2856: note:                 void cv::write(cv::FileStorage&amp;, const std::string&amp;, const cv::Range&amp;)
  /opencv2/core/operations.hpp:2902: note:                 void cv::write(cv::FileStorage&amp;, const std::string&amp;, const cv::Mat&amp;)
  /opencv2/core/operations.hpp:2903: note:                 void cv::write(cv::FileStorage&amp;, const std::string&amp;, const cv::SparseMat&amp;)
  /opencv2/features2d/features2d.hpp:112: note:                 void cv::write(cv::FileStorage&amp;, const std::string&amp;, const std::vector&lt;cv::KeyPoint, std::allocator&lt;cv::KeyPoint&gt; &gt;&amp;)
  </code></pre>
  
  <p>It appears to me that the prototype in <code>/opencv2/features2d/features2d.hpp</code> is a perfect match. Any suggestions?</p>