huihut / OpenCV-MinGW-Build

👀 MinGW 32bit and 64bit version of OpenCV compiled on Windows. Including OpenCV 3.3.1, 3.4.1, 3.4.1-x64, 3.4.5, 3.4.6, 3.4.7, 3.4.8-x64, 3.4.9, 4.0.0-alpha-x64, 4.0.0-rc-x64, 4.0.1-x64, 4.1.0, 4.1.0-x64, 4.1.1-x64, 4.5.0-with-contrib, 4.5.2-x64
https://opencv.org/
928 stars 215 forks source link

undefined reference to `cv::imread(std::string const&, int)' #23

Closed xiongmingzhi closed 3 years ago

xiongmingzhi commented 3 years ago

CMakeFiles\cv.dir/objects.a(main.cpp.obj): In function main': C:/Users/Administrator/Desktop/cv/main.cpp:8: undefined reference tocv::imread(std::string const&, int)' C:/Users/Administrator/Desktop/cv/main.cpp:13: undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)' collect2.exe: error: ld returned 1 exit status mingw32-make.exe[3]: [CMakeFiles\cv.dir\build.make:111: cv.exe] Error 1 mingw32-make.exe[2]: [CMakeFiles\Makefile2:95: CMakeFiles/cv.dir/all] Error 2 mingw32-make.exe[1]: [CMakeFiles\Makefile2:102: CMakeFiles/cv.dir/rule] Error 2 mingw32-make.exe: [Makefile:137: cv] Error 2

huihut commented 3 years ago

This should be a library link issue, you can read about https://stackoverflow.com/questions/34497099/opencv-undefined-reference-to-imread

xiongmingzhi commented 3 years ago

这应该是一个库链接问题,您可以阅读有关https://stackoverflow.com/questions/34497099/opencv-undefined-reference-to-imread的信息

谢谢,确实是因为没有添加dnn的库,,,问题已经解决了。。。