Ask Your Question

Revision history [back]

problems with dev c++ 5.11 and openCV 3.4.1

Hi guys I have a problem when I need to configure the ide Dev c ++. I can not know why this error happens and the tutorials I find on the internet talk about openCv 2.X and the truth is that what they speak does not work for me. I need you to please help me.

The text of the error is the follow:


  • main.cpp:(.text$_ZN2cv3MatD1Ev[_ZN2cv3MatD1Ev]+0x36): undefined reference to `cv::fastFree(void*)'
  • "main.cpp:(.text$_ZN2cv3MataSERKS0_[_ZN2cv3MataSERKS0_]+0x114): undefined reference to `cv::Mat::copySize(cv::Mat const&)' "
  • "main.cpp:(.text$_ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x48): undefined reference to `cv::Mat::deallocate()' "

i downloaded the follow example:

     #include<opencv2/opencv.hpp>
     #include<iostream>
      #include<conio.h>           // may have to modify this line if not using Windows
         using namespace cv;
         int main() {
         Mat imgOriginal;        // input image
         Mat imgGrayscale;       // grayscale of input image
         Mat imgBlurred;         // intermediate blured image
         Mat imgCanny;           // Canny edge image

         imgOriginal = imread("konan_png.png");          // open image

         if (imgOriginal.empty()) {                                  // if unable to open image
         std::cout << "error\n";  // show error message on command line
          _getch();      // may have to modify this line if not using Windows
           return(0);   // and exit program
         }

         cvtColor(imgOriginal, imgGrayscale, CV_BGR2GRAY);       // convert to grayscale

         GaussianBlur(imgGrayscale,  // input image
             imgBlurred,           // output image
          Size(5, 5),       // smoothing window width and height in pixels
             1.5);          // sigma value, determines how much the image will be blurred

         Canny(imgBlurred,     // input image
             imgCanny,             // output image
             82,             // low threshold
             164);  // high threshold

                      // declare windows
         namedWindow("imgOriginal", CV_WINDOW_AUTOSIZE);     // note: you can use CV_WINDOW_NORMAL
               // which     allows resizing the window
         namedWindow("imgCanny", CV_WINDOW_AUTOSIZE);        // or CV_WINDOW_AUTOSIZE for a fixed
     // size window matching the resolution of the image
           // CV_WINDOW_AUTOSIZE is the default
         imshow("imgOriginal", imgOriginal);     // show windows
         imshow("imgCanny", imgCanny);

         waitKey(0);   // hold windows open until user presses a key

         return(0);
         }

Thanks for your help. Sorry my English is not very good :(