fanfan1109 发表于 2006-12-19 22:04

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

我这几天都在编译这个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 /n? n

Select a compiler:
Borland C++Builder version 6.0
Borland C++Builder version 5.0
Borland C++Builder version 4.0
Borland C++Builder version 3.0
Borland C/C++ version 5.02
Borland C/C++ version 5.0
Borland C/C++ (free command line tools) version 5.5
Lcc C version 2.4
Microsoft Visual C/C++ version 7.0
Microsoft Visual C/C++ version 6.0
Microsoft Visual C/C++ version 5.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 /n? n
Please enter the location of your compiler: 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?(/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 /n? n

Select a compiler:
Borland C++Builder version 6.0
Borland C++Builder version 5.0
Borland C++Builder version 4.0
Borland C++Builder version 3.0
Borland C/C++ version 5.02
Borland C/C++ version 5.0
Borland C/C++ (free command line tools) version 5.5
Compaq Visual Fortran version 6.1
Compaq Visual Fortran version 6.6
Digital Visual Fortran version 6.0
Digital Visual Fortran version 5.0
Lcc C version 2.4
Microsoft Visual C/C++ version 7.0
Microsoft Visual C/C++ version 6.0
Microsoft Visual C/C++ version 5.0
WATCOM C/C++ version 11
WATCOM C/C++ version 10.6

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 /n? n
Please enter the location of your compiler: 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?(/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文件后,就可以直接调用了

fanfan1109 发表于 2006-12-20 08:52

多谢帮忙!
这个方法和直接再command 窗口运行有什么不同呢?这样形成的文件应该也是com组件,可以在vs2005里调用的吧

fanfan1109 发表于 2006-12-20 09:06

刚才发现我一直就是在命令窗口输入comtool,然后再在出现的matlab build中做com组件的,不能生成com组件。
帮帮忙啊!是不是我的电脑的设置有什么问题呀!

fanfan1109 发表于 2006-12-20 10:22

我重新装了MATLAB7.0问题解决了
页: [1]
查看完整版本: [紧急求救各位老师]MATLAB下COM组件无法生成