主题:Matlab调用fortran遇到问题
按照《深入浅出MATLAB 7.X混合编程》 董维国 编著里的方法:在CVF里写的
subroutine mexFunction(nlhs, plhs, nrhs, prhs)
call mexPrintf('hemex\n')
return
end
存为hemex.f文件,然后在MATLAB里MEX -STEUP设置好,输入mex -v hemex.f时就报错了,这是为什么啊,求大神解答啊!
下面是设置及出错提示:
>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n?
Select a compiler:
[1] Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio
[2] Lcc C version 2.4.1 in C:\PROGRAM FILES\MATLAB71\sys\lcc
[3] Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio
[0] None
Compiler: 1
Please verify your choices:
Compiler: Digital Visual Fortran 6.0
Location: C:\Program Files\Microsoft Visual Studio
Are these correct?([y]/n):
Try to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
From template: C:\PROGRAM FILES\MATLAB71\BIN\win32\mexopts\df60opts.bat
Done . . .
Warning! The MathWorks has determined that Digital Fortran 6.0 has several
serious bugs, and highly recommends that you upgrade to the latest version
of Compaq Fortran.
***************************************************************************
Warning: The file extension of 32-bit Windows MEX-files was changed
from ".dll" to ".mexw32" in MATLAB 7.1 (R14SP3). The generated
MEX-file will not be found by MATLAB versions prior to 7.1.
Use the -output option with the ".dll" file extension to
generate a MEX-file that can be called in previous versions.
For more information see:
MATLAB 7.1 Release Notes, New File Extension for MEX-Files on Windows
***************************************************************************
>> mex hemex1.f
C:\PROGRAM FILES\MATLAB71\BIN\MEX.PL: Error: Compile of 'hemex1.f' failed.
??? Error using ==> mex
Unable to complete successfully
>> mex -v hemex1.f
This is mex, Copyright 1984-2005 The MathWorks, Inc.
-> Default options filename found in C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R14SP3
----------------------------------------------------------------
-> Options file = C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
MATLAB = C:\Program Files\MATLAB71
-> COMPILER = fl32
-> Compiler flags:
COMPFLAGS = /fpp:"/m /SC:\Program Files\MATLAB71/extern/include" -c -G5 -nologo -DMATLAB_MEX_FILE
OPTIMFLAGS = /MD -Ox -DNDEBUG
DEBUGFLAGS = /MDd -Zi
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /DLL /EXPORT:_MEXFUNCTION@16 /LIBPATH:"C:\Program Files\MATLAB71\extern\lib\win32\digital\df60" libmx.lib libmex.lib libmat.lib /implib:_lib2749.lib /NOLOGO
LINKDEBUGFLAGS = /debug
LINKFLAGSPOST =
Name directive = "/out:hemex1.mexw32"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> "fl32 /fpp:"/m /SC:\Program Files\MATLAB71/extern/include" -c -G5 -nologo -DMATLAB_MEX_FILE /FoC:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\hemex1.obj /MD -Ox -DNDEBUG hemex1.f"
C:\PROGRAM FILES\MATLAB71\BIN\MEX.PL: Error: Compile of 'hemex1.f' failed.
??? Error using ==> mex
Unable to complete successfully
>>
这两个WARNING有关系吗
我的QQ:363842031
谢谢大神