This is Subhash. I am having problem in linking fortran-matlab mex files. I am running MATLAB R2010a. I am trying to mex fortran subroutines in MATLAB. I have installed MSYS, MinGW and gfortran. I have also downloaded and extracted gnumex in the c:\documents\MATLAB folder. I entered gnumex to run the installation settings. At this point, I see a window pop-up and I entered the following:
- MinGW's root directory ---> Pointed towards c:\mingw b) Cygwin's
- root directory -----> left blank c)
- Path to g95.exe ------> c:\mingw\bin
- path to gfortran.exe ------> c:\program files\gfortran\bin e)
- path to gnumex utilities ------> c:\users.....\matlab\gnumex
- environment linking type ------> MinGW
- generate mex dll or engine-----> mex
- language for compilation -------> fortran 77
- add stub ------> no
optimization level -----> -O3
path for libraries and .def files c:\users...\Roaming\MathWorks\MATLAB\R2010a\gnumex
Mex options file to create: c\users...\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat
The above is my installation setup for mex with gnumex. When I hit make options file, an warning message pops out which says " cannot corret mex.pl ..... "cannot open c:...\R2010a\bin\mex.pl for writing"
and when I hit ok, again it pops out saying to confirm overwrite of mexopts.bat . I hit confirm and the opt file is created.
At this point I should have my mex setup ready. But, when I run the fortran mex examples xtimesy.f, etc.. ( I use mex filename.f at the command prompt) and I get the following error
g77: getValidInputLinkLibraries: No such file or directory c:\prog~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'xtimesy.mexw32' failed. Error using ---> mex at 222 unable to complete successfully.
I tried this uninstalling several times, but ended up with the same error. Could anyone please let me know where am I going wrong. Is this not the correct procedure to link the g77? Please throw some light on this.
I appreciate your time..
Thanks.