problems with dev c++ 5.11 and openCV 3.4.1

asked 2018-06-05 19:51:55 -0600

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 :(

edit retag flag offensive close merge delete

Comments

which compiler is used there ? (if that is mingw, then you have to BUILD the opencv libs from src first)

(and please check gcc -v, and report back, it might be too old to be usable anyway)

berak gravatar imageberak ( 2018-06-05 22:34:42 -0600 )edit

ok. the ide: Dev c++ version 5.11. compiler: MinGW64 How can I do that?

how can I do that. And I change the compiler settings and set the binaries directories but nothing. Also the opencv folder does not have a pckg file ... Some tell me that the dev c ++ has not been supported for a while, but I was able to use the SDL library without problems. What "ide" do you recommend me then? Thank you

metamax gravatar imagemetamax ( 2018-06-06 10:17:53 -0600 )edit

your IDE is entirely irrelevant. your compiler is (at least here).

and yes, devcpp5.1.1 is from 2012, that's far too long ago for a fast moving thing like opencv

and no, you can't use any prebuild libs, they are for visualstudio2015/17 only. either get that (recommended, huge download, though) or latest mingw64 (like 7.2 or 7.3 you would still have to build libs from src, though).

berak gravatar imageberak ( 2018-06-06 10:25:14 -0600 )edit

I think it's time to leave behind the old dev c ++. I'm going to use the visual studio. I do not see another solution. There seems to be no way to couple the devc ++ and the open cv 3.4.X. Thanks for answering

metamax gravatar imagemetamax ( 2018-06-06 10:50:43 -0600 )edit

ok sorry one thing more: I can use codeblocks? really i dont like visual stuido

metamax gravatar imagemetamax ( 2018-06-06 11:41:12 -0600 )edit

idk abourt codeblockks, but again, the compiler matters here, not your fav. IDE

berak gravatar imageberak ( 2018-06-06 12:24:39 -0600 )edit

Yes you can use code blocks ide but you will have to build it yourself and here is the way to build it. https://medium.com/@sourabhjigjinni/i... hope it will help

SaqibIrshad gravatar imageSaqibIrshad ( 2020-09-01 14:11:11 -0600 )edit