arlay 发表于 2006-10-25 22:13

求助:将C文件转换成MEX文件时出错

在执行MEX filename.c时,系统提示:

Could not find the compiler "cl" on the DOS path.
Use mex -setup to configure your environment properly.

   C:\PROGRAM FILES\MATLAB704\BIN\WIN32\MEX.PL: Error: Unable to locate compiler.

请问这是什么原因啊?“cl“是什么compiler啊?在这之前我已经mex -setup过了,选的是Microsoft Visual c/c++ 6.0编译器。是因为这个编译器不在MATLAB下吗?当我用Lcc编译器的时候就没问题。请高手指点,谢谢!

eight 发表于 2006-10-25 22:50

原帖由 arlay 于 2006-10-25 22:13 发表
在执行MEX filename.c时,系统提示:

Could not find the compiler "cl" on the DOS path.
Use mex -setup to configure your environment properly.

   C:\PROGRAM FILES\MATLAB704\BIN ...


先用mbuild -setup,再用mex -setup,如果没有错误的话,应该可以编译

happy 发表于 2006-10-26 10:26

http://forum.vibunion.com/forum/thread-23070-1-1.html一样的问题

arlay 发表于 2006-11-2 11:35

1、mbuild -setup,选了msvc6.0编译器;
2、mcc -m filenames, 出错:
   Could not find the compiler "cl" on the DOS path.
Use mbuild -setup to configure your environment properly.


C:\PROGRAM FILES\MATLAB704\BIN\WIN32\\..\WIN32\MEX.PL: Error: Unable to locate compiler.

3、把msvc60engmatopts.bat中的
      rem************************
      rem General parameters
      rem************************
      set MATLAB=%MATLAB%
      set MSVCDir=%MSVCDir%
      set MSDevDir=%MSVCDir%\..\Common\msdev98
      set PATH=%MAVCDir%\BIN;%MSDevDir%\bin;%PATH%

      改为:

      rem************************
      rem General parameters
      rem************************
      set MATLAB=%MATLAB%
      set MSVCDir=C:Program files\Micro...\VC98
      set MSDevDir=%MSVCDir%\..\Common\msdev98
      set PATH=%MAVCDir%\BIN;%MSDevDir%\bin;%PATH%

      再mcc还是出错,出错提示跟上面一样,是什么原因阿?

arlay 发表于 2006-11-6 21:39

请高手指点啊,谢谢啦!^_^

多情清秋 发表于 2006-11-7 01:57

http://www.mathworks.com/support/solutions/data/1-1I5TNS.html?product=ML&solution=1-1I5TNS

Subject:
Why do I get an error message regarding the "cl" compiler on the DOS path when compiling and linking engine programs in MATLAB 7.0.4 (R14SP2)?

Problem Description:
When I compile and link MATLAB Engine programs, MATLAB cannot find the compiler.
For example, type the following at the MATLAB command prompt:

optsFile = fullfile(matlabroot,'bin','win32','mexopts','msvc71engmatopts.bat');
compFile = fullfile(matlabroot,'extern','examples','eng_mat','engwindemo.c');
mex(compFile,'-f',optsFile)

The following error message occurs:
Could not find the compiler "cl" on the DOS path.
Use mex -setup to configure your environment properly.

D:\APPLICATIONS\MATLAB704\BIN\WIN32\MEX.PL: Error: Unable to locate compiler.

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


Solution:
To solve the issue, set MSVCDir to the ACTUAL location of your MSVC install, for
example:
Make a copy of the "msvc71engmatopts.bat" file in the current working directory. Open and edit the file. In line 13, change the "MSVCDir" variable from:


set MSVCDir=%MSVCDir%
to:

set MSVCDir=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
(where C:\Program Files is the directory that contains Microsoft Visual Studio .NET 2003)

arlay 发表于 2006-11-9 15:56

thanks a lot! ^_^

arlay 发表于 2006-11-27 10:33

我选用的是msvc60编译器,把msvc60engmatopts.bat文件拷到当前工作目录下,然后将其中的13行
set MSVCDir=%MSVCDir%
改为
set MSVCDir=C:\Program Files\MATLAB704\extern\lib\win32\microsoft\msvc60
出错:
Could not find the compiler "cl" on the DOS path.
Use mbuild -setup to configure your environment properly.


C:\PROGRAM FILES\MATLAB704\BIN\WIN32\\..\WIN32\MEX.PL: Error: Unable to locate compiler

又改为:
set MSVCDir=C:\Program Files\MathWorks\MATLAB Component Runtime\v72\extern\lib\win32\microsoft\msvc60

但是依然出现同样的错误。

请问各位高手,这到底是什么原因阿?是我的MSVCDir找得不对吗?我是直接搜索的msvc60,搜到两个文件夹分别位于上面两个路径下,然后直接把路径拷贝过去的。

谢谢啦!

happy 发表于 2006-11-27 10:51

原帖由 arlay 于 2006-11-27 10:33 发表
我选用的是msvc60编译器,把msvc60engmatopts.bat文件拷到当前工作目录下,然后将其中的13行
set MSVCDir=%MSVCDir%
改为
set MSVCDir=C:\Program Files\MATLAB704\extern\lib\win32\microsoft\msvc60
出错: ...


MSVCDir显然不对,msvc60你装哪儿上哪儿找去

yu992324 发表于 2010-12-13 17:41

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/C++ (free command line tools) version 5.5
Lcc C version 2.4.1
Microsoft Visual C/C++ version 7.1
Microsoft Visual C/C++ version 6.0

None

Compiler: 5

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

Use C:\Program Files\Microsoft Visual Studio .NET 2003 anyway /n? y

Please verify your choices:

Compiler: Microsoft Visual C/C++ 7.1
Location: C:\Program Files\Microsoft Visual Studio .NET 2003

Are these correct?(/n): y
Warning: Mbuild requires that the Microsoft Visual C++ 7.0
directories "Vc7" and "Common7" be located within the same parent directory.
(Expected to find a directory named "Common7" in the directory 'C:\Program Files\Microsoft Visual Studio .NET 2003'.)
Try to update options file: C:\Users\岳青宇\Application Data\MathWorks\MATLAB\R14SP3\compopts.bat
From template:            E:\PROGRAM FILES\MATLAB71\BIN\win32\mbuildopts\msvc71compp.bat

Done . . .


--> ""E:\Program Files\MATLAB71\bin\win32\mwregsvr" "E:\Program Files\MATLAB71\bin\win32\mwcomutil.dll""

Error: DllRegisterServer in E:\Program Files\MATLAB71\bin\win32\mwcomutil.dll failed
Undefined subroutine &mexsetup::expire called at E:\Program Files\MATLAB71/bin/mexsetup.pm line 752.
??? Error using ==> mbuild
Unable to complete successfully
这个是怎么回事啊?mex.c文件始终是失败的。

mex imsmooth.c
Could not find the compiler "cl" on the DOS path.
Use mex -setup to configure your environment properly.


E:\PROGRAM FILES\MATLAB71\BIN\MEX.PL: Error: Unable to locate compiler.

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


yu992324 发表于 2010-12-13 17:41

求助,,,高手帮助啊……
页: [1]
查看完整版本: 求助:将C文件转换成MEX文件时出错