error while compiling with matlab mex -


i try compile using matlab mex, keep receiving error:

warning: using gcc version "5.4.0-6ubuntu1~16.04.1)".  version      supported mex "4.2.3".      list of supported compilers see:       http://www.mathworks.com/support/compilers/current_release/  in file included descriptor.h:4:0,                  calc_shot.cpp:11: mesh.h: in function ‘double magnitude(const vec3d<t>&)’: mesh.h:106:9: error: ‘sqrt’ not member of ‘std’   return std::sqrt((v1.x*v1.x) + (v1.y*v1.y) + (v1.z*v1.z));          ^ in file included calc_shot.cpp:11:0: descriptor.h: @ global scope: descriptor.h:7:57: error: expected class-name before ‘{’ token  class invalid_mesh_descriptor : public std::logic_error {                                                          ^ descriptor.h: in constructor ‘invalid_mesh_descriptor::invalid_mesh_descriptor()’: descriptor.h:9:57: error: expected class-name before ‘(’ token     explicit invalid_mesh_descriptor() : std::logic_error("exception invalid_mesh_descriptor caught.") {}                                                          ^ descriptor.h:9:57: error: expected ‘{’ before ‘(’ token descriptor.h: in constructor ‘invalid_mesh_descriptor::invalid_mesh_descriptor(const string&)’: descriptor.h:10:70: error: expected class-name before ‘(’ token     invalid_mesh_descriptor(const std::string& msg) : std::logic_error("exception invalid_mesh_descriptor caught: "+msg) {}                                                                       ^ descriptor.h:10:70: error: expected ‘{’ before ‘(’ token descriptor.h: in function ‘std::ostream& operator<<(std::ostream&, const vec_descriptor<t>&)’: descriptor.h:123:45: error: no match ‘operator<<’ (operand types ‘std::ostream {aka std::basic_ostream<char>}’ , ‘const char [2]’)        (size_t k=1; k < d.size(); ++k) s << " " << d(k);                                              ^ in file included /usr/include/c++/5/string:52:0,                  descriptor.h:5,                  calc_shot.cpp:11: /usr/include/c++/5/bits/basic_string.h:5172:5: note: candidate: template<class _chart, class _traits, class _alloc> std::basic_ostream<_chart, _traits>& std::operator<<(std::basic_ostream<_chart, _traits>&, const std::__cxx11::basic_string<_chart, _traits, _alloc>&)      operator<<(basic_ostream<_chart, _traits>& __os,      ^ /usr/include/c++/5/bits/basic_string.h:5172:5: note:   template argument deduction/substitution failed: in file included calc_shot.cpp:11:0: descriptor.h:123:48: note:   mismatched types ‘const std::__cxx11::basic_string<_chart, _traits, _alloc>’ , ‘const char [2]’        (size_t k=1; k < d.size(); ++k) s << " " << d(k);                                                 ^      mex: compile of ' "calc_shot.cpp"' failed. 

i used compile code ld_preload @ moment not remember argument, how can solve?

solution:

mex -v calc_shot.cpp shot_descriptor.cpp -duse_flann -i"c:\program files\flann\include" -i/usr/include/eigen3 

using command programs works charm


Comments