calling mex file error
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I am trying to execute an example found in mathworks. The example is very simple:
copyfile(fullfile(matlabroot,'extern','examples','refbook',...
'loadsparse.F'),'.','f');
copyfile(fullfile(matlabroot,'extern','examples','refbook',...
'fulltosparse.F'),'.','f');
mex -largeArrayDims fulltosparse.F loadsparse.F
So indeed those files, where copied in my current folder. But then the following error shows up.
cl : Command line warning D9024 : unrecognized source file type 'fulltosparse.F', object file assumed
cl : Command line warning D9027 : source file 'fulltosparse.F' ignored
cl : Command line warning D9021 : no action performed
C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'fulltosparse.F'
Error using mex (line 206)
Unable to complete successfully.
NOTHING FROM WHAT I FOUND IN PREVIOUS THREADS WORKED.
I have installed the SDK 7.1 as suggested. Indeed, by running the "mex-setup" i can get the following confirmation:
Your machine has a Microsoft Software Development Kit (SDK) compiler located at
C:\Program Files (x86)\Microsoft Visual Studio 10.0. Do you want to use this compiler [y]/n?
And then,
Trying to update options file: C:\Users\Minamar\AppData\Roaming\MathWorks\MATLAB\R2012b\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2012b\bin\win64\mexopts\mssdk71opts.bat
Done . . .
So, I am wondering whether the location of the compiler should be somewhere else or not and how I can proceed for fixing this error.
Thanks
0 Kommentare
Antworten (1)
James Tursa
am 27 Jun. 2014
Bearbeitet: James Tursa
am 27 Jun. 2014
fulltosparse.F and loadsparse.F are Fortran source files, not C source files. You would need to select a Fortran compiler to mex them. The reason you are getting an "Unrecognized source file type" message is because the C compiler doesn't understand what a .F file is, so it assumes it may be an object file (which it isn't). Try the fulltosparse.c source file instead (from the same folder), which is intended for a C compiler.
2 Kommentare
James Tursa
am 27 Jun. 2014
Bearbeitet: James Tursa
am 27 Jun. 2014
Yes, you need to install a Fortran compiler since MATLAB does not ship with one. Intel Visual Fortran Composer would be suitable for this (unfortunately they are also expensive). You can check the doc to see which Fortran version(s) are officially supported by the version of MATLAB you have.
Siehe auch
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!