I installed opencv using homebrew. I am trying to build a project by linking to opencv. However, I got the following error.
Undefined symbols for architecture x86_64: "cv::FileStorage::FileStorage(std::__1::basic_string, std::__1::allocator > const&, int, std::__1::basic_string, std::__1::allocator > const&)", referenced from: kmeans_save(_VlKMeans const*) in imall.cpp.o kmeans_read() in imall.cpp.o learn_codebook(std::__1::basic_string, std::__1::allocator >) in imall.cpp.o encoding(std::__1::basic_string, std::__1::allocator >) in imall.cpp.o "cv::write(cv::FileStorage&, std::__1::basic_string, std::__1::allocator > const&, cv::Mat const&)", referenced from: cv::FileStorage& cv::operator<< >(cv::FileStorage&, cv::Mat_ const&) in imall.cpp.o cv::FileStorage& cv::operator<< >(cv::FileStorage&, cv::Mat_ const&) in imall.cpp.o "cv::write(cv::FileStorage&, std::__1::basic_string, std::__1::allocator > const&, float)", referenced from: cv::FileStorage& cv::operator<<(cv::FileStorage&, float const&) in imall.cpp.o "cv::write(cv::FileStorage&, std::__1::basic_string, std::__1::allocator > const&, int)", referenced from: cv::FileStorage& cv::operator<<(cv::FileStorage&, int const&) in imall.cpp.o "cv::imread(std::__1::basic_string, std::__1::allocator > const&, int)", referenced from: learn_codebook(std::__1::basic_string, std::__1::allocator >) in imall.cpp.o encoding(std::__1::basic_string, std::__1::allocator >) in imall.cpp.o "cv::Exception::Exception(int, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, int)", referenced from: cv::FileStorage& cv::operator<<(cv::FileStorage&, int const&) in imall.cpp.o cv::FileStorage& cv::operator<<(cv::FileStorage&, float const&) in imall.cpp.o cv::FileStorage& cv::operator<< >(cv::FileStorage&, cv::Mat_ const&) in imall.cpp.o cv::FileStorage& cv::operator<< >(cv::FileStorage&, cv::Mat_ const&) in imall.cpp.o "cv::operator<<(cv::FileStorage&, std::__1::basic_string, std::__1::allocator > const&)", referenced from: cv::operator<<(cv::FileStorage&, char const*) in imall.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am not sure how to fix it. Thanks.