title: Fixing mixed STL implementation with OpenCV
body: <p><strong>Problem</strong></p>
  
  <p>I am trying to get OpenCV up and running, but I ran into the same problem as <a href="https://stackoverflow.com/questions/11781139/opencv-functions-can-only-be-invoked-in-c-code-fashion-but-not-in-c-fashion">this guy</a> and <a href="http://answers.opencv.org/question/1074/simple-opencv-program-with-link-error-on/" rel="nofollow noreferrer">this guy</a> - I get linker errors when trying to build the project with the C++ interface, but with C interface the project builds.</p>
  
  <p>In the second link, the answer is "You're mixing different implementations of STL. VC10 (for OpenCV) and STLPort (for your code)."</p>
  
  <p>How can I make sure that I am only using VC10? (or later versions)</p>
  
  <p><strong>C style (Project builds successfully)</strong></p>
  
  <p>I am using Visual Studio 2012 and OpenCV 3.0</p>
  
  <pre><code>int main( int argc, char** argv )
  {
      char* filename = "input.tif";  
      IplImage *img0;
  
      if( (img0 = cvLoadImage(filename,-1)) == 0 )
         return 0;
  
      cvNamedWindow( "image", 0 );
      cvShowImage( "image", img0 );
      cvWaitKey(0);  
      cvDestroyWindow("image");
      cvReleaseImage(&amp;img0);
  }
  </code></pre>
  
  <p><strong>C++ style (Project does not build)</strong></p>
  
  <pre><code>int main( int argc, char** argv ) {
  
      Mat image;
      const string &amp;filename = "input.tif";
      image = imread(filename, IMREAD_COLOR); // Read the file
  
      if(! image.data ) // Check for invalid input
      {
          std::cout &lt;&lt; "Could not open or find the image" &lt;&lt; std::endl ;
          return -1;
      }
  
      namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
      imshow( "Display window", image ); // Show our image inside it.
  }
  </code></pre>
  
  <p><strong>Errors:</strong></p>
  
  <pre><code>1&gt;Source.obj : error LNK2019: unresolved external symbol "private: char * __thiscall cv::String::allocate(unsigned int)" (?allocate@String@cv@@AAEPADI@Z) referenced in function "public: __thiscall cv::String::String(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;)" (??0String@cv@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
  1&gt;Source.obj : error LNK2019: unresolved external symbol "private: void __thiscall cv::String::deallocate(void)" (?deallocate@String@cv@@AAEXXZ) referenced in function "public: __thiscall cv::String::~String(void)" (??1String@cv@@QAE@XZ)
  1&gt;Source.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class cv::String const &amp;,int)" (?imread@cv@@YA?AVMat@1@ABVString@1@H@Z) referenced in function _main
  1&gt;Source.obj : error LNK2019: unresolved external symbol "void __cdecl cv::namedWindow(class cv::String const &amp;,int)" (?namedWindow@cv@@YAXABVString@1@H@Z) referenced in function _main
  1&gt;Source.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class cv::String const &amp;,class cv::_InputArray const &amp;)" (?imshow@cv@@YAXABVString@1@ABV_InputArray@1@@Z) referenced in function _main
  </code></pre>
  
  <p><strong>Include and lib path settings in VS</strong></p>
  
  <ul>
  <li><em>C/C++/General/Additional Include Directories:</em> C:\opencv\build\include</li>
  <li><em>Linker/General/Additional Library Directories:</em> 
  \n
  C:\opencv\build\x86\vc11\lib</li>
  <li><em>Linker/Input/Additional Dependencies:</em>
  opencv_calib3d2410d.lib
  opencv_contrib2410d.lib
  opencv_core2410d.lib
  opencv_features2d2410d.lib
  opencv_flann2410d.lib
  opencv_gpu2410d.lib
  opencv_highgui2410d.lib
  opencv_imgproc2410d.lib
  opencv_legacy2410d.lib
  opencv_ml2410d.lib
  opencv_nonfree2410d.lib
  opencv_objdetect2410d.lib
  opencv_ocl2410d.lib
  opencv_photo2410d.lib
  opencv_stitching2410d.lib
  opencv_superres2410d.lib
  opencv_ts2410d.lib
  opencv_video2410d.lib
  opencv_videostab2410d.lib</li>
  </ul>