problem with making mex file
2 views (last 30 days)
Show older comments
Hello guys, I am new to all this, so please be patient with me!
So I got this library from internet (<http://www.cvlibs.net/software/libelas/>) which is written in C++ but comes with MATLAB wrappers.
I am able to compile the c++ code and run the demo.
But following their guidance to make the Matlab wrapper (by just running 'make'), I get the following error:
Error using mex Undefined symbols for architecture x86_64: "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from: void std::__1::vector<Elas::triangle, std::__1::allocator<Elas::triangle> >::__push_back_slow_path<Elas::triangle const>(Elas::triangle const&) in elas.o void std::__1::vector<Elas::support_pt, std::__1::allocator<Elas::support_pt> >::__push_back_slow_path<Elas::support_pt const>(Elas::support_pt const&) in elas.o std::__1::vector<Elas::triangle, std::__1::allocator<Elas::triangle> >::vector(std::__1::vector<Elas::triangle, std::__1::allocator<Elas::triangle> > const&) in elas.o std::__1::vector<Elas::support_pt, std::__1::allocator<Elas::support_pt> >::vector(std::__1::vector<Elas::support_pt, std::__1::allocator<Elas::support_pt> > const&) in elas.o "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from: Elas::process(unsigned char*, unsigned char*, float*, float*, int const*) in elas.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in elas.o Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::setVal(double, int, int, int, int) in matrix.o Matrix::diag(Matrix const&) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o ... "std::__1::ios_base::getloc() const", referenced from: Elas::process(unsigned char*, unsigned char*, float*, float*, int const*) in elas.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in elas.o Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::setVal(double, int, int, int, int) in matrix.o Matrix::diag(Matrix const&) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o ... "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from: std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in elas.o std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in matrix.o "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from: std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in elas.o std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in matrix.o "std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from: Elas::process(unsigned char*, unsigned char*, float*, float*, int const*) in elas.o Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::setVal(double, int, int, int, int) in matrix.o Matrix::diag(Matrix const&) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o Matrix::operator+(Matrix const&) in matrix.o ... "std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from: Elas::process(unsigned char*, unsigned char*, float*, float*, int const*) in elas.o Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::setVal(double, int, int, int, int) in matrix.o Matrix::diag(Matrix const&) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o Matrix::operator+(Matrix const&) in matrix.o ... "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in elas.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in matrix.o "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in elas.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in matrix.o "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)", referenced from: Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::diag(Matrix const&) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o Matrix::operator+(Matrix const&) in matrix.o Matrix::operator-(Matrix const&) in matrix.o Matrix::operator*(Matrix const&) in matrix.o ... "std::__1::cerr", referenced from: Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::setVal(double, int, int, int, int) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o Matrix::operator+(Matrix const&) in matrix.o Matrix::operator-(Matrix const&) in matrix.o Matrix::operator*(Matrix const&) in matrix.o ... "std::__1::cout", referenced from: Elas::process(unsigned char*, unsigned char*, float*, float*, int const*) in elas.o Matrix::diag(Matrix const&) in matrix.o "std::__1::ctype<char>::id", referenced from: Elas::process(unsigned char*, unsigned char*, float*, float*, int const*) in elas.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in elas.o Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::setVal(double, int, int, int, int) in matrix.o Matrix::diag(Matrix const&) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o ... "std::__1::locale::~locale()", referenced from: Elas::process(unsigned char*, unsigned char*, float*, float*, int const*) in elas.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in elas.o Matrix::getMat(int, int, int, int) in matrix.o Matrix::setMat(Matrix const&, int, int) in matrix.o Matrix::setVal(double, int, int, int, int) in matrix.o Matrix::diag(Matrix const&) in matrix.o Matrix::reshape(Matrix const&, int, int) in matrix.o ... "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_tra
Error in make (line 25) mex('elasMex.cpp','../src/elas.cpp','../src/descriptor.cpp', '../src/filter.cpp', ...
------------------------------------------
Is this a linking problem? how can I sort this?
I am using Matlab R2014a, and Mac OSX 10.9.2
Thanks a lot in advance,
0 Comments
Answers (1)
Bruno Pop-Stefanov
on 9 May 2014
If this is the first time you're using mex you'll have to choose a compiler before being able to use it:
>> mex -setup
Is your installation of MATLAB 64-bit? You can check with
>> mexext
You can compile 64-bit applications if this command returns mexw64 or something similar.
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!