matlab与fortran的接口问题
为什么我在matlab环境下用mex -setup命令选择了fortran编译器,但运行mex primef.f命令不能生成dll文件呢?显示结果如下:
>> mex yprimef.f
Creating library _lib6232.lib and object _lib6232.exp
_lib6232.exp : error LNK2001: unresolved external symbol _MEXFUNCTION@16
yprimef.dll : fatal error LNK1120: 1 unresolved externals
C:\MATLAB6P5\BIN\WIN32\MEX.PL: Error: Link of 'yprimef.dll' failed.
??? Error using ==> mex
Unable to complete successfully 可能是fortran版本问题,你的是什么版本? mex -setup的时候让系统自动检测已经安装的fortran看看是什么结果 我的fortran是6.6的
怎么让系统自动检测已经安装的fortran啊? 我用的是VF6.6,添加一个名为Fortran.lic的license文件后编译一直都是正常的 那个文件是从哪来的? 原帖由 sprit314 于 2006-8-13 17:57 发表
那个文件是从哪来的?
我安装完后自动就有了,在license目录下
请教调用FORTRAN程序问题
楼上你好!刚刚因为论文需要计算接口,一直没有成功。现在向您请教。我是用MATLAB R2007a 调用v fortran6.5程序,按照书上写小的程序试验,总是出现这样的错误mex fact.f90
Error fact.f90: 3syntax error; found `mexfunction' expecting `;'
Error fact.f90: 4extraneous old-style parameter list
Error fact.f90: 4syntax error; found `integer' expecting `;'
Error fact.f90: 4syntax error; found `plhs' expecting `;'
Error fact.f90: 4syntax error; found `*' expecting `)'
Error fact.f90: 4skipping `*'
Error fact.f90: 4syntax error; found `*' expecting `)'
Error fact.f90: 4skipping `*'
Error fact.f90: 5syntax error; found `integer' expecting `;'
Error fact.f90: 5syntax error; found `mxgetpr' expecting `;'
Error fact.f90: 6syntax error; found `integer' expecting `;'
Error fact.f90: 6syntax error; found `y_pr' expecting `;'
Error fact.f90: 7syntax error; found `integer' expecting `;'
Error fact.f90: 7syntax error; found `nlhs' expecting `;'
Error fact.f90: 8syntax error; found `integer' expecting `;'
Error fact.f90: 8syntax error; found `i' expecting `;'
Error fact.f90: 9syntax error; found `real' expecting `;'
Error fact.f90: 9syntax error; found `*' expecting `;'
Error fact.f90: 9missing identifier
Error fact.f90: 9syntax error; found `8' expecting `;'
Error fact.f90: 9too many errors
C:\PROGRA~1\MATLAB\R2007A\BIN\MEX.PL: Error: Compile of 'fact.f90' failed.
??? Error using ==> mex at 206
Unable to complete successfully.
我用的是matlab自带的编译器,编译C例子程序已经成功,就是fortran总是类似错误。
源程序是:
subroutine mexfunction(nlhs,plhs,nrhs,prhs)
integer plhs(*),prhs(*)
integer mxgetpr,mxcreatedoublematrix
integer y_pr
integer nlhs,nrhs
integer i
real*8 x,y,mxgetscalar
x=mxgetscalar(prhs(1))
prhs(1)=mxcreatedoublematrix(1,1,0)
y_pr=mxgetpr(plhs(1))
y=1.0
do i=x,1,-1
y=y*i
end do
call mxcopyreal8toptr(y,y_pr,1)
return
end
望不吝赐教
刚才补发完全 请高手指导
请问那个Fortran.lic对6.5版本合适吗?怎样得到呢?
页:
[1]