calling mex file error

3 次查看(过去 30 天)
msh
msh 2014-6-27
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

回答(1 个)

James Tursa
James Tursa 2014-6-27
编辑:James Tursa 2014-6-27
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 个评论
msh
msh 2014-6-27
编辑:msh 2014-6-27
Thanks James, but my target is to a run a fortran subroutine. In this case, the SDK alone is not suitable ? Do I also need to install the, Intel Visual Fortran Composer XE 2013 or 2011 for instance ?
For a beginner like me, the matlab information was not very clear if this is the case. Nevertheless, the compatible Intel compilers are not available for free ? what's the solution in this case ?
James Tursa
James Tursa 2014-6-27
编辑:James Tursa 2014-6-27
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by