Using mex to compile fortran code
이전 댓글 표시
I have Matlab R2012b (8.0.0.783) 64bit (maci64) installed in a Mac OS X (10.8.8) - Snow leopard. For compiling FORTRAN I have installed the GNU gfortran 4.3.4 which according to http://www.mathworks.com/support/compilers/R2012b/maci64.html is supported by my matlab's version.
I have coded the mexopt.sh file in order to allow matlab to find the gfortran as follows:
FC='/usr/local/bin/gfortran'
FFLAGS='-fexceptions -m64 -fbackslash'
FC_LIBDIR='/usr/local/lib/'
FC_LIBDIR2='/usr/local/lib/gcc/x86_64-apple-darwin/4.3.4/'
FLIBS="\$MLIBS-L\$FC_LIBDIR"
FOPTIMFLAGS='-O5 -funroll-loops -ftree-vectorize'
LDDEBUGFLAGS='-g'
Without this workaround I got the message gfortran: unknown command, although through the terminal I was able to run gfortran.
Meanwhile, when trying to compile the example timestwo.F (from matlab examples) by making
mex timestwo.F
I get the following error: -o: command not found which I think is related to the linking process since by just compiling
mex -c timestwo.F
Can someone who has more experience and knowledge help me out? I would be grateful.
Thanks in advance.
Ricardo
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!