C:/Users/myuser/Desktop/URSS/main.cpp:6: undefined reference to cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)
I tried to search online, and tried different stuff, different tutorials, but nothing seems to work, if i cant find any solution here, i guess i will just give up on this project.
My code is this:
#include <iostream>
#include <opencv2/opencv.hpp>
int main(int argc, char** argv){
auto filename = "C:/Users/myuser/Desktop/541957.png";
auto image = cv::imread(filename);
cv::imshow("Image", image);
cv::waitKey();
return 0;
}
you’re probably also new to c++, building peograms & all …
your linker is telling you, that it wants to use some function (cv::imread()) but it cannot find it’s implementation – , you’re not linking the correct library !!
depending on what you installed - either add opencv_imgcodecs480.lib or opencv_world480.lib (which contains all other opencv libs) to your “Additional Link Libraries”
what you installed , only has libs for the VS compiler, you cannot use that with mingw
so, bad news is: you MUST build the opencv libs from src (resulting in *.a libs) before you can build your own program, using mingw (or change compiler → ~7gb dl)
(good news is, you already got the correct mingw version, there are plenty, which do not work AT ALL)