声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2187|回复: 3

[混合编程] 请教:linux中matlab中安装mex后,不能用

[复制链接]
发表于 2009-1-12 10:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
在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 ([y]/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
回复
分享到:

使用道具 举报

发表于 2009-1-12 23:27 | 显示全部楼层

回复 楼主 zhaonatju 的帖子

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

2
这个选1试试看
 楼主| 发表于 2009-1-13 18:21 | 显示全部楼层

回复 沙发 ch_j1985 的帖子

选1试了,还是不行,请问一下,是不是要把调用的fortran程序先写为mex形式的fortran中的程序,然后在在matlab中mex  +文件名,这样对吗?还有应该把文件存放在哪个路径?
发表于 2009-1-13 23:14 | 显示全部楼层

回复 板凳 zhaonatju 的帖子

个人对这方面也不在行!
文件应放在Current Directory下吧
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-12 18:39 , Processed in 0.062746 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表