필터 지우기
필터 지우기

mex can't find gcc in path

조회 수: 3 (최근 30일)
Robert
Robert 2011년 8월 22일
Matlab-mex can't find my C compiler, even though it appears to be using the correct command. Observe:
In Matlab: >> mex foo.c /Applications/MATLAB_R2011a.app/bin/mex: line 305: gcc-4.2: command not found /Applications/MATLAB_R2011a.app/bin/mex: line 1041: gcc-4.2: command not found
In Terminal: $which gcc-4.2 /Developer/usr/bin/gcc-4.2
Any idea how to get mex to find the compiler? I'm using Mac OS Lion and 2011a.

채택된 답변

Robert
Robert 2011년 8월 22일
I figured it out. All I had to do is run: sudo ln -s /Developer/usr/bin/gcc-4.2 /usr/bin/gcc-4.2
The problem was that /Developer/usr/bin/ is in my Terminal path, but apparently not in mex's path when looking for a compiler.

추가 답변 (2개)

Nathan
Nathan 2012년 4월 22일
For anyone (like me) that the above fix did not work for, download the patch discussed here: http://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/
And make the modification to mexopts.sh described here: http://www.mathworks.com/matlabcentral/newsreader/view_thread/317343
Those two did the trick for me.

Shahab
Shahab 2012년 5월 31일
Thank you Nathan :) it is exciting.

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by