Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Undefined reference to cv::imread(std::string const&, int) #13000
I am building a project with OpenCV 4 beta and when I use the function cv::imread or cv::imwrite I get an undefined reference to the functions.
My CMakeLists.txt is as follows:
find_package(OpenCV 4.0.0 REQUIRED)
message(STATUS "OpenCV library status:")
message(STATUS "Torch library status:")
And the program is as follows:
Am I linking OpenCV correctly with cmake? It seems that if I comment out the torch parts from CMake, the program build succesfully. Any ideas?
Ok this is what I have tried:
g++ -std=c++11 main.cpp -o test
Then this works.
If I also run the above CMakeLists.txt file with:
it finds OpenCV 3.4.2 that I have in my system installed for python and then this also works.
Any ideas why? I installed OpenCV 4.0-beta from downloading the zip file that is in the website and I build it with cmake.
These lines are required for OpenCV 4.0 apps:
Into /usr/local ? Side-by-side installations may not work in this case (too many possible conflicts).
We don't help with remote investigation of problems which we are not able to reproduce on our side (because it is very time consuming and usually configuration problem without any following fix into OpenCV), but we can take a look on the clear reason of the problem and suggest some fix/workaround.
No I have opencv 3.4.2 on Miniconda folder not on usr/local and that what cmake finds.
I have removed opencv 4 beta and I have build the 3.4.3.
I did the same steps again with find_package(OpenCV 3.4.3 REQUIRED) and everything seems to
I don't know if I am missing something, but it seemed that with imread, imwrite and other io functions opencv 4.0.0 beta didn't work. I guess I will work with opencv 3.4.3. for now.
I have not looked into OpenCV 4.0 yet, but C++11 requirements should be set by OpenCV itself through
Current minimal supported CMake version is 3.5.x (Ubuntu 16.04 has 3.5.1 by default).