2016-08-01 11 views
-1

나는 matlab에 MEX를 사용하여 컴파일하려고하고 있어요,하지만 난이 오류를 수신 유지 :오류 matlab에 MEX로 컴파일하는 동안

Warning: You are using gcc version "5.4.0-6ubuntu1~16.04.1)". The version 
    currently supported with MEX is "4.2.3". 
    For a list of currently supported compilers see: 
    http://www.mathworks.com/support/compilers/current_release/ 

In file included from descriptor.h:4:0, 
       from calc_shot.cpp:11: 
mesh.h: In function ‘double magnitude(const vec3d<T>&)’: 
mesh.h:106:9: error: ‘sqrt’ is not a member of ‘std’ 
    return std::sqrt((v1.x*v1.x) + (v1.y*v1.y) + (v1.z*v1.z)); 
     ^
In file included from calc_shot.cpp:11:0: 
descriptor.h: At 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 for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘const char [2]’) 
     for (size_t k=1; k < d.size(); ++k) s << " " << d(k); 
              ^
In file included from /usr/include/c++/5/string:52:0, 
       from descriptor.h:5, 
       from 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 from calc_shot.cpp:11:0: 
descriptor.h:123:48: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘const char [2]’ 
     for (size_t k=1; k < d.size(); ++k) s << " " << d(k); 
               ^

    mex: compile of ' "calc_shot.cpp"' failed. 

내가 LD_PRELOAD이 코드를 컴파일하는 데 사용하지만, 그 순간에 내가 인수를 기억하지 않는다 어떻게 해결할 수 있습니까?

+0

같은 작품이 명령을 사용하여

mex -v calc_shot.cpp shot_descriptor.cpp -DUSE_FLANN -I"C:\Program Files\flann\include" -I/usr/include/eigen3 

. 여분의 헤더를 추가해야 할 수도 있습니다. 첫 번째 예제 인'mesh.h : 106 : 9 : error : 'sqrt'는 'std'의 멤버가 아닙니다. 그 이유는 실제로 #include '이 필요하기 때문일 수 있습니다. 이 같은 다른 문제가있을 수도 있지만 잘 모르겠습니다. – patrik

+0

다른 예는'descriptor.h : 123 : 45 : error : 'operator <<'에 일치하지 않습니다 (피연산자 유형은 'std :: ostream {일명 :: basic_ostream }'및 'const char [2]') '. 이 코드는 아마도 #include ' – patrik

+0

이 좋을 것입니다. 올바른 매개 변수를 사용하여 컴파일하려고했지만 기억이 안납니다. – Luca

답변

1

솔루션 : 프로그램은 내가 모든 컴파일러가 헤더 같은 방법을 포함하지 않는 것으로 나타났습니다 매력