• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Matlab编译COM组件的解决方案

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
 目前项目需要应用VS.net调用Matlab编译生成的COM组件。首先需要配置Matlab的C/C++编译器,由于我的VS.net并没有安装在C盘的根目录下,而在Matlab的命令行中输入mbuild -setup和mex -setup命令时,若选择mbuild to locate installed compilers,则找不到C/C++的编译器,无法完成编译器的配置(若用户的C/C++编译器安装在C盘默认路径上,则不会出现这个问题),从而导致使用Matlab COM Builder编译COM组件不成功,出现如下错误提示:


解决方法如下:(蓝色字体为用户输入命令)
>>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] D:\Program Files\Microsoft Visual Studio .NET 2003   (用户根据VC/VS.net的安装目录进行相应更改)
Please verify your choices:  

Compiler: Microsoft Visual C/C++ 7.0
Location: D:\Program Files\Microsoft Visual Studio .NET 2003  
Are these correct?([y]/n): y 
The default options file:
"C:\Documents and Settings\tutuya\Application Data\MathWorks\MATLAB\R13\compopts.bat"
is being updated from D:\MATLAB6P5\BIN\WIN32\mbuildopts\msvc70compp.bat...  
--> "D:\MATLAB6p5\bin\win32\mwregsvr D:\MATLAB6p5\bin\win32\mwcomutil.dll" 
DllRegisterServer in D:\MATLAB6p5\bin\win32\mwcomutil.dll succeeded 
--> "D:\MATLAB6p5\bin\win32\mwregsvr D:\MATLAB6p5\bin\win32\mwcommgr.dll" 
DllRegisterServer in D:\MATLAB6p5\bin\win32\mwcommgr.dll succeeded

>>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] D:\Program Files\Microsoft Visual Studio .NET 2003 (用户根据VC/VS.net的安装目录进行相应更改)

Please verify your choices:  
Compiler: Microsoft Visual C/C++ 7.0
Location: D:\Program Files\Microsoft Visual Studio .NET 2003  
Are these correct?([y]/n): y
 
The default options file:
"C:\Documents and Settings\tutuya\Application Data\MathWorks\MATLAB\R13\mexopts.bat"
is being updated from D:\MATLAB6P5\BIN\WIN32\mexopts\msvc70opts.bat...

C/C++编译器配置成功!


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi视频教程第一季发布时间:2022-07-18
下一篇:
2020年Delphi我还在坚持学习发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap