声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3019|回复: 4

[混合编程] [紧急求救各位老师]MATLAB下COM组件无法生成

[复制链接]
发表于 2006-12-19 22:04 | 显示全部楼层 |阅读模式

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

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

x
我这几天都在编译这个COM组件,可是一直出错,现在用的是VS2005和MATLAB6.5,VS的路径是C:\Program Files\Microsoft Visual Studio 8,MATLAB的路径是C:\MATLAB6p5,我已经一,编译了mbuild -setup,显示:
>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:

Would you like mbuild to locate installed compilers [y]/n? n

Select a compiler:
[1] Borland C++Builder version 6.0
[2] Borland C++Builder version 5.0
[3] Borland C++Builder version 4.0
[4] Borland C++Builder version 3.0
[5] Borland C/C++ version 5.02
[6] Borland C/C++ version 5.0
[7] Borland C/C++ (free command line tools) version 5.5
[8] Lcc C version 2.4
[9] Microsoft Visual C/C++ version 7.0
[10] Microsoft Visual C/C++ version 6.0
[11] Microsoft Visual C/C++ version 5.0

[0] None

Compiler: 9

The default location for Microsoft Visual C/C++ compilers is C:\Program Files\Microsoft Visual Studio .NET,
but that directory does not exist on this machine.  

Use C:\Program Files\Microsoft Visual Studio .NET anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio .NET] C:\Program Files\Microsoft Visual Studio 8

Please verify your choices:

Compiler: Microsoft Visual C/C++ 7.0
Location: C:\Program Files\Microsoft Visual Studio 8

Are these correct?([y]/n): y

The default options file:
"C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R13\compopts.bat"
is being updated from C:\MATLAB6P5\BIN\WIN32\mbuildopts\msvc70compp.bat...


--> "C:\MATLAB6p5\bin\win32\mwregsvr C:\MATLAB6p5\bin\win32\mwcomutil.dll"

DllRegisterServer in C:\MATLAB6p5\bin\win32\mwcomutil.dll succeeded

--> "C:\MATLAB6p5\bin\win32\mwregsvr C:\MATLAB6p5\bin\win32\mwcommgr.dll"

DllRegisterServer in C:\MATLAB6p5\bin\win32\mwcommgr.dll succeeded

二,编译了mex -setup,显示
>> mex -setup
Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n? n

Select a compiler:
[1] Borland C++Builder version 6.0
[2] Borland C++Builder version 5.0
[3] Borland C++Builder version 4.0
[4] Borland C++Builder version 3.0
[5] Borland C/C++ version 5.02
[6] Borland C/C++ version 5.0
[7] Borland C/C++ (free command line tools) version 5.5
[8] Compaq Visual Fortran version 6.1
[9] Compaq Visual Fortran version 6.6
[10] Digital Visual Fortran version 6.0
[11] Digital Visual Fortran version 5.0
[12] Lcc C version 2.4
[13] Microsoft Visual C/C++ version 7.0
[14] Microsoft Visual C/C++ version 6.0
[15] Microsoft Visual C/C++ version 5.0
[16] WATCOM C/C++ version 11
[17] WATCOM C/C++ version 10.6

[0] None

Compiler: 13

The default location for Microsoft Visual C/C++ compilers is C:\Program Files\Microsoft Visual Studio .NET,
but that directory does not exist on this machine.  

Use C:\Program Files\Microsoft Visual Studio .NET anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files\Microsoft Visual Studio .NET] C:\Program Files\Microsoft Visual Studio 8

Please verify your choices:

Compiler: Microsoft Visual C/C++ 7.0
Location: C:\Program Files\Microsoft Visual Studio 8

Are these correct?([y]/n): y

The default options file:
"C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R13\mexopts.bat"
is being updated from C:\MATLAB6P5\BIN\WIN32\mexopts\msvc70opts.bat...

三,将msvc70engmatopts文件中的
MSVCDir=%MSVCDir%改成MSVCDir=%C:\Program Files\Microsoft Visual Studio 8%,这里不知道改对没有,因为我的C:\Program Files\Microsoft Visual Studio 8路径下还有vc和vc#的文件夹,不知是否还要写再下面的路径。

四,在我的电脑的环境变量path中添加了%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;d:\matlab\bin\win32;c:\matlab6p5\extern\include;c:\matlab6p5\extern\lib\win32\microsoft\msvc70;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;c:\matlab6p5\bin\win32

可是运行comtool时还是显示:
Building standalone executable...
mcc -M -silentsetup -d 'C:/MATLAB6p5/work/comtest/src'  -B 'csglcom:comtest,sgltest,1.0'  -i C:/MATLAB6p5/work/im_test.m C:/MATLAB6p5/work/split2rgb.m   
  Could not find the compiler "cl" on the DOS path.
  Use mbuild -setup to configure your environment properly.


  MBUILD.BAT: Error: Unable to locate compiler.

运行:
optsFile = fullfile(matlabroot,'bin','win32','mexopts','msvc70engmatopts.bat');
compFile = fullfile(matlabroot,'extern','examples','eng_mat','engwindemo.c');
mex(compFile,'-f',optsFile);
就显示:
Could not find the compiler "cl" on the DOS path.
  Use mex -setup to configure your environment properly.


  C:\MATLAB6P5\BIN\WIN32\MEX.PL: Error: Unable to locate compiler.

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

现在要疯掉了,不知道怎么弄了,希望各位老师指点迷津!感激不尽!
回复
分享到:

使用道具 举报

发表于 2006-12-19 22:22 | 显示全部楼层
你用comtool工具编译
在命令窗口输入comtool
就出现com工具了,
用这个工具编译后成dll文件后,就可以直接调用了
 楼主| 发表于 2006-12-20 08:52 | 显示全部楼层
多谢帮忙!
这个方法和直接再command 窗口运行有什么不同呢?这样形成的文件应该也是com组件,可以在vs2005里调用的吧
 楼主| 发表于 2006-12-20 09:06 | 显示全部楼层
刚才发现我一直就是在命令窗口输入comtool,然后再在出现的matlab build中做com组件的,不能生成com组件。
帮帮忙啊!是不是我的电脑的设置有什么问题呀!
 楼主| 发表于 2006-12-20 10:22 | 显示全部楼层
我重新装了MATLAB7.0问题解决了
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-12-1 20:43 , Processed in 0.077188 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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