Error compiling mex file ubuntu with armadillo library

1 次查看(过去 30 天)
Hi!
I am trying to compile a mex file on ubuntu starting from a cpp file using the armadillo library. However, I get this strange error when joining 3 vectors and when determining if a vertor is full of zeros.
Error using mex
/home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/arma_test2.cpp: In function void mexFunction(int, mxArray**, int,
const mxArray**)’:
/home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/arma_test2.cpp:107:41: error: no matching function for call to
join_horiz(arma::rowvec&, arma::rowvec&, arma::rowvec&)
rowvec out=join_horiz(vec1,vec2,vec3);
^
In file included from /usr/include/armadillo:493:0,
from /home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/armaMex.hpp:21,
from /home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/arma_test2.cpp:2:
/usr/include/armadillo_bits/fn_join.hpp:85:1: note: candidate: template<class T1, class T2> typename
arma::enable_if2<((arma::is_arma_type<T1>::value && arma::is_arma_type<T2>::value) && arma::is_same_type<typename
T1::elem_type, typename T2::elem_type>::value), const arma::Glue<T1, T2, arma::glue_join_rows> >::result
arma::join_horiz(const T1&, const T2&)
join_horiz(const T1& A, const T2& B)
^~~~~~~~~~
/usr/include/armadillo_bits/fn_join.hpp:85:1: note: template argument deduction/substitution failed:
/home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/arma_test2.cpp:107:41: note: candidate expects 2 arguments, 3
provided
rowvec out=join_horiz(vec1,vec2,vec3);
^
In file included from /usr/include/armadillo:493:0,
from /home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/armaMex.hpp:21,
from /home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/arma_test2.cpp:2:
/usr/include/armadillo_bits/fn_join.hpp:219:1: note: candidate: template<class T1, class T2> const arma::SpGlue<T1,
T2, arma::spglue_join_rows> arma::join_horiz(const arma::SpBase<typename T1::elem_type, T1>&, const
arma::SpBase<typename T1::elem_type, T2>&)
join_horiz(const SpBase<typename T1::elem_type,T1>& A, const SpBase<typename T1::elem_type,T2>& B)
^~~~~~~~~~
/usr/include/armadillo_bits/fn_join.hpp:219:1: note: template argument deduction/substitution failed:
/home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/arma_test2.cpp:107:41: note: arma::rowvec {aka
arma::Row<double>}is not derived from ‘const arma::SpBase<typename T1::elem_type, T1>
rowvec out=join_horiz(vec1,vec2,vec3);
^
/home/b8054452/Downloads/Copy_of_MEX_EXAMPLE_2/arma_test2.cpp:110:13: error: arma::rowvec {aka class
arma::Row<double>}has no member named ‘is_zero’; did you mean ‘is_row’?
if(vec1.is_zero()==true)
^~~~~~~
The strange thing is that when compiling it with windows everything works as supposed.
Any idea how to fix it?
THANKS!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by