title: c++ openCV 3.1 - can't use Mat or most of the openCV things like in the tutorials
body: <p>Best</p>
  
  <p>I'm trying to create a project in C++, which relays most of the time on the 
  <strong>open-cv library</strong>. </p>
  
  <p>Therefore, I've installed <strong>open-cv3.1.0</strong> on my <strong>windows</strong> machine and connected the
  <strong>library</strong> and <strong>include</strong> map/files to my <strong>netbeans</strong> c++ project.</p>
  
  <hr>
  
  <h2>Succes</h2>
  
  <p>Overall I think that I've managed to do this correctly because
  I don't receive any errors when I <strong>compile</strong>/<strong>run</strong> the application with the next piece of code in it.</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  using namespace cv;
  </code></pre>
  
  <p>++ I can read an images in and visualize it :)</p>
  
  <pre><code>CvMat *img = cvLoadImageM(location.c_str(),CV_LOAD_IMAGE_GRAYSCALE);
  cvNamedWindow( "My Window", 1 );
  cvShowImage( "My Window", img );
  cvWaitKey();
  </code></pre>
  
  <hr>
  
  <h2>Problem</h2>
  
  <p><strong>But</strong> as soon as I take a random tutorial. E.g.</p>
  
  <pre><code>// create a big 8Mb matrix
  Mat A(1000, 1000, CV_64F);
  </code></pre>
  
  <p><a href="http://docs.opencv.org/3.0-last-rst/modules/core/doc/intro.html" rel="nofollow">http://docs.opencv.org/3.0-last-rst/modules/core/doc/intro.html</a></p>
  
  <p><strong>Or even</strong></p>
  
  <pre><code>Mat A;
  </code></pre>
  
  <p>Then I get immediately an compile error :</p>
  
  <pre><code>g++     -o dist/Debug/Cygwin-Windows/ai4 build/Debug/Cygwin-Windows/PrincipalComponentAnalysis.o build/Debug/Cygwin-Windows/ReadInImage.o build/Debug/Cygwin-Windows/main.o -L../../../netbeans/OpenCV/opencv/build/x64/vc14/bin -lopencv_world310 -lopencv_world310d
  build/Debug/Cygwin-Windows/PrincipalComponentAnalysis.o: In function `cv::Mat::~Mat()':
  /cygdrive/d/fun/ai/ai4/../../../netbeans/OpenCV/opencv/build/include/opencv2/core/mat.inl.hpp:571: undefined reference to `cv::fastFree(void*)'
  ...
  </code></pre>
  
  <hr>
  
  <p>The only things which doesn't give me an error are :</p>
  
  <pre><code>CvMat A;
  CvMat *B;
  IplImage *C;
  IplImage D;
  </code></pre>
  
  <p>Which s***t because most (all) the tutorials, and stackoverflow issues are using the <strong>Mat A</strong>  or <strong>cv::Mat A</strong> version.</p>
  
  <hr>
  
  <h2>Question</h2>
  
  <p>Thus the question : Did you've ever had the same kind of problem or issue? and are you willing to help me? + How can I solve it. </p>
  
  <hr>
  
  <h2>edit : Configuration steps - OpenCV 3.1</h2>
  
  <p>Tools --> Options --> c/c++ --> Code Assistance :</p>
  
  <ul>
  <li>D:\netbeans\openCV\opencv\build\include</li>
  <li>D:\netbeans\openCV\opencv\build\include\opencv2</li>
  </ul>
  
  <p>R-click Project --> Properties --> build --> C++ Compiler --> include directories</p>
  
  <ul>
  <li>../../../netbeans/OpenCV/opencv/build/include</li>
  <li>../../../netbeans/OpenCV/opencv/build/include/opencv2</li>
  </ul>
  
  <p>R-click Project --> Properties --> build --> linker --> Additional Library Directories</p>
  
  <ul>
  <li>../../../netbeans/OpenCV/opencv/build/x64/vc14/bin</li>
  </ul>
  
  <p>R-click Project --> Properties --> build --> linker --> Libraries --> Add Labrary</p>
  
  <ul>
  <li>opencv_world310</li>
  <li>opencv_world310d</li>
  </ul>
  
  <hr>
  
  <h2>Solution</h2>
  
  <ol>
  <li>Download CMake</li>
  <li>Download OpenCV</li>
  <li>Download <strong>MinGW</strong> &lt;-- Use this as compiler instead of <strong>cygwin</strong></li>
  <li>Install <strong>MinGW</strong> </li>
  <li>Follow this link --> <a href="http://eyalarubas.com/opencv-installation-on-windows-netbeans-mingw.html" rel="nofollow">http://eyalarubas.com/opencv-installation-on-windows-netbeans-mingw.html</a></li>
  </ol>