/usr/bin/ld: //usr/local/lib/libopencv_imgcodecs.a(loadsave.cpp.o): in function `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
loadsave.cpp:(.text._ZN2cv6imreadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi+0x432): undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
/usr/bin/ld: //usr/local/lib/libopencv_imgcodecs.a(grfmt_hdr.cpp.o): in function `cv::HdrEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)':
grfmt_hdr.cpp:(.text._ZN2cv10HdrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1b2): undefined reference to `cv::merge(cv::_InputArray const&, cv::_OutputArray const&)'
/usr/bin/ld: //usr/local/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): in function `cv::Jpeg2KDecoder::readData(cv::Mat&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x6fc): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/usr/bin/ld: //usr/local/lib/libopencv_imgcodecs.a(grfmt_pfm.cpp.o): in function `cv::PFMDecoder::readData(cv::Mat&)':
grfmt_pfm.cpp:(.text._ZN2cv10PFMDecoder8readDataERNS_3MatE+0x30f): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/usr/bin/ld: //usr/local/lib/libopencv_imgcodecs.a(grfmt_tiff.cpp.o): in function `cv::TiffDecoder::readData_32FC3(cv::Mat&)':
grfmt_tiff.cpp:(.text._ZN2cv11TiffDecoder14readData_32FC3ERNS_3MatE+0x145): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/usr/bin/ld: grfmt_tiff.cpp:(.text._ZN2cv11TiffDecoder14readData_32FC3ERNS_3MatE+0x176): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/usr/bin/ld: //usr/local/lib/libopencv_imgcodecs.a(grfmt_tiff.cpp.o): in function `cv::TiffEncoder::write_32FC3(cv::Mat const&)':
grfmt_tiff.cpp:(.text._ZN2cv11TiffEncoder11write_32FC3ERKNS_3MatE+0xb4): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/usr/bin/ld: //usr/local/lib/libopencv_imgcodecs.a(grfmt_webp.cpp.o):grfmt_webp.cpp:(.text._ZN2cv11WebPDecoder8readDataERNS_3MatE+0x3d8): more undefined references to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' follow
collect2: error: ld returned 1 exit status
What I don't get is why libopencv_imgcodecs.a is missing references even though they shoud have been included in libopencv_imgproc.a which is linked just before libopencv_imgcodecs.
> What I don't get is why libopencv_imgcodecs.a is missing references even though they shoud
> have been included in libopencv_imgproc.a which is linked just before libopencv_imgcodecs.
> -lopencv_imgproc -lopencv_imgcodecs
If, at the point the linker scans opencv_imgproc to see if it matches ANY of the currently known unresolved symbols, it finds no matches, then the library will not be included.
The symbol has to be unresolved at the point the library is being scanned.
If it becomes unresolved later, then you either need to
- reorder the libraries into a better search order
- list the same library twice to break a cyclic dependency