wangyanyy 发表于 2006-8-23 15:55

为什么COM组件无法成功创建?

因为我想用c#编程中用到matlab,所以在尝试把.m文件做成com组件。我用的版本是matlab6.5
我在网上找了个m文件:
function test(h,D)
for x=-10:0.1:10,
if x>D
      y=h;
      hold on;
      plot(x,y)
elseif x<-D
      y=-h;
      hold on;
      plot(x,y)
else
      y=h/(D*x);
      hold on;
      plot(x,y)
end
end

用com builder创建com组件的时候出错:
          Error using==>comtool(build)
          Error:An error occurred while shelling out to mbuild(error code=1).
          Unable to build executable(specify the -v option for more information)

Building standalone executable...
mcc -M -silentsetup -d 'C:/MATLAB6p5/work/me/src'-B 'cppcom:me,me,1.0'-i C:/MATLAB6p5/bin/win32/test.m   
Warning: File: c:/matlab6p5/bin/win32/test.m Line: 6 Column: 7
References to "plot" require the C/C++ Graphics Library when executing in stand-alone mode. You must specify -B sgl or -B sglcpp in order to use the C/C++ Graphics Library. Also, if using the -W option, you must specify either the mainhg or libhg wrapper type. A run-time error will occur if the C/C++ Graphics Library is not present when "plot" is called.
Warning: File: c:/matlab6p5/bin/win32/test.m Line: 10 Column: 7
References to "plot" require the C/C++ Graphics Library when executing in stand-alone mode. You must specify -B sgl or -B sglcpp in order to use the C/C++ Graphics Library. Also, if using the -W option, you must specify either the mainhg or libhg wrapper type. A run-time error will occur if the C/C++ Graphics Library is not present when "plot" is called.
Warning: File: c:/matlab6p5/bin/win32/test.m Line: 14 Column: 7
References to "plot" require the C/C++ Graphics Library when executing in stand-alone mode. You must specify -B sgl or -B sglcpp in order to use the C/C++ Graphics Library. Also, if using the -W option, you must specify either the mainhg or libhg wrapper type. A run-time error will occur if the C/C++ Graphics Library is not present when "plot" is called.
mbuild is choosing an appropriate compiler...
Modification of non-creatable array value attempted, subscript -1 at C:/MATLAB6p5/bin/win32/mexsetup.pm line 625.


请大家帮我看看是什么原因啊,谢谢大家了!!!我都弄了一天了。。。

[ 本帖最后由 wangyanyy 于 2006-8-23 16:01 编辑 ]

happy 发表于 2006-8-23 15:57

这个回答有点问题,没看你的程序,只看了一下你的运行错误

请见谅

[ 本帖最后由 happy 于 2006-8-23 19:54 编辑 ]

wangyanyy 发表于 2006-8-23 16:12

请问教授能告诉我怎么样改文件或者怎么样用函数包装吗?我刚开始接触这个 还对这个不怎么明白呢 谢谢!
还有,我看网上的例子就是用的这个文件啊,为什么他的就能通过?

happy 发表于 2006-8-23 19:56

你试一下mcc -B

mcc -m 变异的是不含图形界面的
含有图形界面的用mcc -B sql

wangyanyy 发表于 2006-8-23 20:20

哦 好的 我查查 谢谢!
页: [1]
查看完整版本: 为什么COM组件无法成功创建?