找回密码
 注册
Simdroid-非首页
查看: 76|回复: 2

用mcc将m文件生成dll时提示无法找到cl编译器

[复制链接]
发表于 2008-11-9 22:25:14 | 显示全部楼层 |阅读模式 来自 重庆沙坪坝区
用的matlab6.5.
我现在想在vc中调用m文件中的函数,因此想将m文件生成dll,为了充分说明问题,我把前面编译器配置过程也说一下。
mex -setup
Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n? n
.....
mbuild -setup
Please choose your compiler for building standalone MATLAB applications:

Would you like mbuild to locate installed compilers [y]/n? n
....
两个命令后面都出现了类似的警告,如下:
Warning: Mbuild requires that the Microsoft Visual C++ 6.0
directories "VC98" and "Common" be located within the same parent directory.
(Expected to find a directory named "Common" in the directory 'e:\program files'.)
The default options file:
"C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R13\compopts.bat"
is being updated from E:\MATLAB6P5\BIN\WIN32\mbuildopts\msvc60compp.bat...


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

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

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

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

Installing the MATLAB Visual Studio add-in ...

  Warning: Could not update e:\program files\common\msdev98\template\MATLABWizard.awx
    from E:\MATLAB6P5\BIN\WIN32\MATLABWizard.awx
  Warning: Could not update e:\program files\common\msdev98\template\MATLABWizard.hlp
    from E:\MATLAB6P5\BIN\WIN32\MATLABWizard.hlp
  Warning: Could not update e:\program files\common\msdev98\addins\MATLABAddin.dll
    from E:\MATLAB6P5\BIN\WIN32\MATLABAddin.dll
  Warning: Could not update e:\program files\common\msdev98\bin\usertype.dat
    from E:\MATLAB6P5\BIN\WIN32\usertype.dat

上面我选择的是vc6.0.
我没有理会,然后我用 mcc -t -h -L C -W lib:ppp -T link:lib myfunct.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.

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

??? Error: An error occurred while shelling out to mbuild (error code = 1).
Unable to build executable (specify the -v option for more information).

Error in ==> E:\MATLAB6p5\toolbox\compiler\mcc.dll

请问这是怎么回事呢?请指点一下!(但却生成了.h 和.c文件)
焦急等待中!
 楼主| 发表于 2008-11-9 23:11:09 | 显示全部楼层 来自 重庆沙坪坝区
Simdroid开发平台
自己补充一下,我已按照网上资料将msvc70engmatopts.bat文件copy到work当前工作目录,并将MSVCDir改为编译器cl所在目录E:\Program Files\Bin。
回复 不支持

使用道具 举报

 楼主| 发表于 2008-11-10 17:10:53 | 显示全部楼层 来自 重庆沙坪坝区
嗨,一直都没人来解答,好伤心哦!
不过我自己把问题解决了,先把方法说出来,以便后来人碰到同样的问题可用。
其实问题的关键在上面提示里的那句警告:
Warning: Mbuild requires that the Microsoft Visual C++ 6.0
directories "VC98" and "Common" be located within the same parent directory.
(Expected to find a directory named "Common" in the directory 'e:\program files'.)
然后我仔细一看我的vc安装目录,不知怎搞的居然发现没有vc98目录,真是笑死人了,天天用vc竟然没发现这个问题。(我是编译器装在e盘,而可执行程序和其它公共库在c盘的)所以我就把vc卸载了,重新装了一遍(一切都装在同个目录)。一切ok,然后再mex和mbuild就一切顺利了。
所以总结是:matlab找不到编译器可能与你的vc6.0安装方式有关系。

评分

1

查看全部评分

回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-10-4 21:17 , Processed in 0.045686 second(s), 18 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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