wgun 发表于 2014-6-29 21:03

matlab调用fortran,mex出现问题?

我的matlab7.1和fortran6.5,fortran编译器是6.0的。
在matlab工作区输入:mex -setup然后mex readraw.f90(我的fortran文件,包括接口程序和计算程序)出现:
>> mex -setup
Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers /n? y

Select a compiler:
Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio
Lcc C version 2.4.1 in D:\PROGRAM FILES\MATLAB71\sys\lcc
Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio

None

Compiler: 1

Please verify your choices:

Compiler: Digital Visual Fortran 6.0
Location: C:\Program Files\Microsoft Visual Studio

Are these correct?(/n): y

Try to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
From template:            D:\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 redaraw.f90

D:\PROGRAM FILES\MATLAB71\BIN\MEX.PL: Error: 'redaraw.f90' not found.

??? Error using ==> mex
Unable to complete successfully

请问大侠们这是什么原因?

chybeyond 发表于 2014-6-29 21:35

把要编译文件所在文件夹设置到当前路径下试试

wgun 发表于 2014-6-29 22:10

本帖最后由 wgun 于 2014-6-29 22:15 编辑

chybeyond 发表于 2014-6-29 21:35
把要编译文件所在文件夹设置到当前路径下试试
我把matlab工作区的路径设置到编译文件所在的路径了,这样对吗?还是不行,出现上面的错误

chybeyond 发表于 2014-6-29 23:27

wgun 发表于 2014-6-29 22:10
我把matlab工作区的路径设置到编译文件所在的路径了,这样对吗?还是不行,出现上面的错误

把currentfolder设置为编译文件所在文件夹的最后一级目录

wgun 发表于 2014-6-30 01:11

chybeyond 发表于 2014-6-29 23:27
把currentfolder设置为编译文件所在文件夹的最后一级目录

是current directory吗?

chybeyond 发表于 2014-6-30 08:35

wgun 发表于 2014-6-30 01:11
是current directory吗?

current folder

wgun 发表于 2014-6-30 12:11

chybeyond 发表于 2014-6-30 08:35
current folder

那就是一个地方,我的7.1版本的,显示是current directory,和你的current folder是一样的。我原来就是设置为编译文件所在文件夹的最后一级目录,但是还是出现上面的那个错误。我在网上搜了,好多出现和我一样的问题,就是没答案。是我的fortran编译器版本太老吗?

chybeyond 发表于 2014-6-30 15:02

wgun 发表于 2014-6-30 12:11
那就是一个地方,我的7.1版本的,显示是current directory,和你的current folder是一样的。我原来就是设 ...

没遇到过这样的问题,可能是版本兼容,matlab各版本支持的编译器:http://www.mathworks.cn/support/sysreq/previous_releases.html


       

wgun 发表于 2014-6-30 20:52

本帖最后由 wgun 于 2014-6-30 21:23 编辑

chybeyond 发表于 2014-6-30 15:02
没遇到过这样的问题,可能是版本兼容,matlab各版本支持的编译器:http://www.mathworks.cn/support/sysr ...
谢谢,chybeyond,换成matlab7.0就行了,但是编译失败,可能是我的fortran程序有错吧。
你能给我一个能编译的fortran程序例子吗,最简单的例子就行,我的邮箱38432603@qq.com,先谢了啊。请看图片附件,matlab7.0支持fortran6.1和6.6吗?后面都打×了



页: [1]
查看完整版本: matlab调用fortran,mex出现问题?