Устанавливаю в MacOS из исходников OpenCV примерно так:
cd opencv-4.3.0
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ../
make -j7
make install
все ставится - ошибок никаких...
После этого пытаюсь скомпилировать пример
g++ -std=c++11 -I/usr/local/include/opencv4 -L opencv-4.3.0/build/lib -L /usr/local/lib/opencv4 example.cpp
Линковка завершается ошибкой:
Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in example-4b35ae.o
"cv::Mat::deallocate()", referenced from:
cv::Mat::release() in example-4b35ae.o
"cv::Canny(cv::_InputArray const&, cv::_OutputArray const&, double, double, int, bool)", referenced from:
_main in example-4b35ae.o
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in example-4b35ae.o
"cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)", referenced from:
_main in example-4b35ae.o
"cv::waitKey(int)", referenced from:
_main in example-4b35ae.o
"cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)", referenced from:
_main in example-4b35ae.o
"cv::fastFree(void*)", referenced from:
cv::Mat::operator=(cv::Mat&&) in example-4b35ae.o
cv::Mat::~Mat() in example-4b35ae.o
"cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const", referenced from:
_main in example-4b35ae.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Как это можно исправить?