In my simple first OpenCV application I want to save frames got by cam so I am using imwrite()
as tutorial say. The problem, is that I can't compile because I get this error:
Undefined symbols for architecture x86_64:
"cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)", referenced from:
_main in video-87ad7a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reading some posts here in SO I have discovered it's a problem about the C++ standard library which is used, so I added the flag libstdc++
but the following:
g++ -stdlib=libstdc++ -I/usr/local/include -L/usr/local/lib/ -g -o binary video.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_stitching -lopencv_videoio -lopencv_videostab
has not solved the problem. How shall I do?
UPDATE it seems this is the solution. I don't know what was the damned flag I was missing
Looks like you are missing '-lopencv_imgcodecs' where imwrite() lives.
Refer to OpenCV imgcodecs header file here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With