zhaonatju 发表于 2009-1-12 10:48

请教:linux中matlab中安装mex后,不能用

在linux中matlab调用一个fortran程序,安装mex后,还是不能用,请大家帮忙。下面是运行的情况:
>> mex -setup

    Using the 'mex -setup' command selects an options file that is
    placed in ~/.matlab/R14 and used by default for 'mex'. An options
    file in the current working directory or specified on the command line
    overrides the default options file in ~/.matlab/R14.

    Options files control which compiler to use, the compiler and link command
    options, and the runtime libraries to link against.

    To override the default options file, use the 'mex -f' command
    (see 'mex -help' for more information).

The options files available for mex are:

1: /opt/matlab/bin/f90opts.sh :
      Template Options file for building Fortran 90 MEX-files via the system ANSI compiler

2: /opt/matlab/bin/gccopts.sh :
      Template Options file for building gcc MEX-files

3: /opt/matlab/bin/mexopts.sh :
      Template Options file for building MEX-files via the system ANSI compiler


Enter the number of the options file to use as your default options file:

2
Overwrite /home/hzh/.matlab/R14/mexopts.sh (/n)?
y

/opt/matlab/bin/gccopts.sh is being copied to
/home/hzh/.matlab/R14/mexopts.sh

>> mex -g aa.f
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

    mex: link of 'aa.mexglx' failed.

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

ch_j1985 发表于 2009-1-12 23:27

回复 楼主 zhaonatju 的帖子

Enter the number of the options file to use as your default options file:

2
这个选1试试看

zhaonatju 发表于 2009-1-13 18:21

回复 沙发 ch_j1985 的帖子

选1试了,还是不行,请问一下,是不是要把调用的fortran程序先写为mex形式的fortran中的程序,然后在在matlab中mex+文件名,这样对吗?还有应该把文件存放在哪个路径?

ch_j1985 发表于 2009-1-13 23:14

回复 板凳 zhaonatju 的帖子

个人对这方面也不在行!
文件应放在Current Directory下吧
页: [1]
查看完整版本: 请教:linux中matlab中安装mex后,不能用