필터 지우기
필터 지우기

Compiled MEX function is not recognized in MATLAB R2013a on MAC OX 10.8 Mount Lion

조회 수: 2 (최근 30일)
Dear all, I am trying to use mex functions on my new MACBook Pro (running MATLAB R2013). I installed XCode 5.2 (latest version). I updated mexopts.sh to recognize Mount Lion (10.8). When I compile by:
> mex -v -g myfile.c -output myfile_ex
The compilation seems to go smoothly (myfile_ex.mexmaci64 is created). Yet when I invoke my function, I get:
myfunction_ex(input1) >> Undefined function "myfunction_ex" for input arguments of type "double".
On other platforms (Window Vista Pro, Ubuntu 13.04) this file is successfully compiled. I have no clue why on MAC is not working. It seems that my MATLAB is not able to recognize my MEX function. And it does so with any mex function that I try to compile. Simply the *.mexmaci64 function is not recognized by matlab.
Any help will be really appreciated.
Cheers, Maurizio
  댓글 수: 1
Maurizio De Pitta'
Maurizio De Pitta' 2013년 12월 5일
Just an update to this issue.
It seems that even if a mex function looks compiled successfully, but then matlab is not able to recognize it, then it is because some of the library internally were not linked correctly. Weird enough is that no warning message is provided.
It will need further thoughts, but changing the file extension from C to CPP, and thus compiling it by the g++ compiler solved the issue.
Alternatively, you can keep the C extension but make sure that the CLIBS flag in your meshopts.sh file (/Applications/MATLAB_$VERSION$.app/bin) includes -lstdc (and not -lstdc++ as in the original version).
So, apparently there was a wrong setting in the mexopts.sh file.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by