matlab m文件 dll,求助matlab的M文件作成dll的错误

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

依照例子,写了myadd2.m如下:

function [y,z] = myadd2(a,b)

% dummy function, just to demonstrate the idea

y = a+b;

z = a+2*b;

将 Matlab 函数转成 DLL 函数:

1、用

mcc -W cpplib:libmyadd2 -T link:lib myadd2.m –v

出现以下错误,

??? Error: "cpplib:libmyadd2" is not a valid -W option argument.

Error in ==> D:\MATLAB6p5\toolbox\compiler\mcc.dll

为什么会如此?

2、用

mcc -W lib:libsum_prod -T link:lib sum_prod.m –v

出现??? Error: File "–v" not found.

Error in ==> D:\MATLAB6p5\toolbox\compiler\mcc.dll

mcc -W lib:libsum_prod -T link:lib sum_prod.m

出现

_lib1696.def : error LNK2001: 无法解析的外部符号 mlfMyadd2

_lib1696.def : error LNK2001: 无法解析的外部符号 mlxMyadd2

libmyadd2.lib : fatal error LNK1120: 2 个无法解析的外部命令

LINK : fatal error LNK1141: 导出文件生成期间失败

MBUILD.BAT: Error: Link of 'libmyadd2.dll' failed.

??? Error using ==> mbuild

Unable to complete successfully

??? Error: An error occurred while shelling out to mbuild (error code = 1).

Unable to build executable (specify the -v option for more information).

Error in ==> D:\MATLAB6p5\toolbox\compiler\mcc.dll

检查了,

mbuild.bat文件如下,也没有看出来什么意思呢。

@echo off

rem MBUILD.BAT

rem

rem    Compile and link script used for building math library

rem    standalone files.

rem

rem

rem

rem

rem -------------------------------------------------------------------

rem   MATLAB root directory

rem -------------------------------------------------------------------

rem

set MATLAB=d:\MATLAB6p5

rem ------------- Do not modify anything below this line --------------

rem

rem ###################################################################

rem # Set up script location

rem ###################################################################

rem # use the installed location of mex.pl, or %0 if mbuild was called by

rem # full path name, or look for it on the DOS path.

set SCRIPTLOC=""

if not "%MATLAB%" == ""  set SCRIPTLOC="%MATLAB%\bin\win32\mex.pl"

if not exist %SCRIPTLOC% set SCRIPTLOC=%0\..\mex.pl

if not exist %SCRIPTLOC% set SCRIPTLOC=%0\..\win32\mex.pl

if not exist %SCRIPTLOC% set SCRIPTLOC=-S mex.pl

rem ###################################################################

rem # Set up perl location

rem ###################################################################

rem # Either use the installed location of perl,

rem # or use %0 if mbuild was called by full path name,

rem # or search for mbuild.bat on the DOS path

rem # or hope it is on the DOS path.

set PERLLOC=""

if not "%MATLAB%" == "" set PERLLOC="%MATLAB%\sys\perl\win32\bin\perl.exe"

if not exist %PERLLOC% set PERLLOC="%0\..\..\sys\perl\win32\bin\perl.exe"

if not exist %PERLLOC% set PERLLOC="%0\..\..\..\sys\perl\win32\bin\perl.exe"

if not exist %PERLLOC% for %%x in (%PATH%) do if exist "%%x\mbuild.bat" set PERLLOC="%%x\..\..\sys\perl\win32\bin\perl.exe"

if not exist %PERLLOC% set PERLLOC=perl

rem ###################################################################

rem # Set up script arguments (to avoid %9 DOS batch file limit)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值