필터 지우기
필터 지우기

calling mex file error

조회 수: 3 (최근 30일)
msh
msh 2014년 6월 27일
편집: James Tursa 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