Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile.m on mac #2

Open
malreddysid opened this issue Nov 25, 2016 · 1 comment
Open

compile.m on mac #2

malreddysid opened this issue Nov 25, 2016 · 1 comment

Comments

@malreddysid
Copy link

Hi

I'm trying to compile the code on MacOS and I'm running into the following error.

Undefined symbols for architecture x86_64: "cv::SparseMatConstIterator::SparseMatConstIterator(cv::SparseMat const*)", referenced from: MxArray::MxArray(cv::SparseMat const&) in MxArray.o "cv::SparseMatConstIterator::operator++()", referenced from: MxArray::MxArray(cv::SparseMat const&) in MxArray.o "cv::Mat::deallocate()", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o _mexFunction in calcIIF.o cv::MatExpr::~MatExpr() in calcIIF.o std::__1::__vector_base<cv::Mat, std::__1::allocator<cv::Mat> >::~__vector_base() in calcIIF.o MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o MxArray::toMat(int, bool) const in MxArray.o MxArray::toMatND(int, bool) const in MxArray.o ... "cv::Mat::setTo(cv::_InputArray const&, cv::_InputArray const&)", referenced from: MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o "cv::Mat::zeros(cv::Size_<int>, int)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::Mat::create(int, int const*, int)", referenced from: MxArray::toMat(int, bool) const in MxArray.o "cv::Mat::copySize(cv::Mat const&)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o MxArray::toMat(int, bool) const in MxArray.o MxArray::toMatND(int, bool) const in MxArray.o std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> > MxArray::toVector<cv::Mat>() const in MxArray.o std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >::__swap_out_circular_buffer(std::__1::__split_buffer<cv::Mat, std::__1::allocator<cv::Mat>&>&) in MxArray.o void std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >::__push_back_slow_path<cv::Mat>(cv::Mat&&) in MxArray.o ... "cv::Mat::Mat(int, int const*, int, void*, unsigned long const*)", referenced from: MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o MxArray::toMat(int, bool) const in MxArray.o MxArray::toMatND(int, bool) const in MxArray.o "cv::add(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, int)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::blur(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, cv::Point_<int>, int)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::error(int, cv::String const&, char const*, char const*, int)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::merge(cv::_InputArray const&, cv::_OutputArray const&)", referenced from: MxArray::toMat(int, bool) const in MxArray.o "cv::split(cv::_InputArray const&, cv::_OutputArray const&)", referenced from: MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o "cv::String::deallocate()", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::String::allocate(unsigned long)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::Moments::Moments(double, double, double, double, double, double, double, double, double, double)", referenced from: MxArray::toMoments(unsigned long) const in MxArray.o "cv::compare(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int)", referenced from: MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o "cv::inRange(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::noArray()", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::fastFree(void*)", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o _mexFunction in calcIIF.o cv::MatExpr::~MatExpr() in calcIIF.o std::__1::__vector_base<cv::Mat, std::__1::allocator<cv::Mat> >::~__vector_base() in calcIIF.o MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o MxArray::toMat(int, bool) const in MxArray.o MxArray::toMatND(int, bool) const in MxArray.o ... "cv::SparseMat::ptr(int, int, bool, unsigned long*)", referenced from: MxArray::toSparseMat() const in MxArray.o "cv::SparseMat::create(int, int const*, int)", referenced from: MxArray::toSparseMat() const in MxArray.o "cv::_InputArray::kind() const", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::_InputArray::getMat_(int) const", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::Mat::t() const", referenced from: MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o MxArray::toMat(int, bool) const in MxArray.o MxArray::toMatND(int, bool) const in MxArray.o "cv::Mat::mul(cv::_InputArray const&, double) const", referenced from: doWork(cv::_InputArray const&, cv::Size_<int>, int) in calcIIF.o "cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const", referenced from: MxArray::MxArray(cv::Mat const&, mxClassID, bool) in MxArray.o MxArray::toMat(int, bool) const in MxArray.o MxArray::toMatND(int, bool) const in MxArray.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Could you please help me with this.

@toddlt
Copy link

toddlt commented May 10, 2017

First you should install opencv by homebrew brew install opencv
it is installed in /usr/local/Cellar/opencv/
then comile the MxArray.cpp, you need to add the compile flag like this:

mex -I'/usr/local/Cellar/opencv/2.4.13_3/include' -I'/usr/local/Cellar/opencv/2.4.13_3/include/opencv' -L'/usr/local/Cellar/opencv/2.4.13_3/lib' -c MxArray.cpp

the output is MxArray.o, you will need it when you compile calcIIF.cpp:

mex -I'/usr/local/Cellar/opencv/2.4.13_3/include' -I'/usr/local/Cellar/opencv/2.4.13_3/include/opencv' -L'/usr/local/Cellar/opencv/2.4.13_3/lib' -lopencv_core -lopencv_imgproc calcIIF.cpp MxArray.o

Other c/c++ file can be compiled just use mex xxx.c or mex xxx.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants