笔者的配置环境为MATLAB2013a,vs2010。打算将.m文件生成COM组件,但是遇到如下问题: E:\MATLAB~1\BIN\MEX.PL: Error: The current options file is not configured to create DLLs. You can use mbuild -setup to set up an options file which is configured to create DLLs. Error: An error occurred while shelling out to mbuild (error code = 9). Unable to build executable. ??? Error using ==> mccError executing mcc, return status = 1. There were errors during compilation process. |
在网上各种找答案,均没有解决。最后没办法看官方的英文文档,找到了思路。
不用MATLAB自带的GUI,直接用命令生成COM组件。
例如 mcc -v -W 'com:my_xiaobo,myclass,1.0' -T link:lib xiaobo.m。
就可以生成名为my_xiaobo的COM组件,并且其类名为myclass,版本号为1.0,方法名为xiaobo。
成功解决问题。
如果出现Error: regsvr32 for xx_1_0.dll failed.
则是由于权限不够,请用管理员权限运行。
如果你解决了问题,请告诉我,我们一起进步!