【已经解决】请教:如何配置C#编译器
我VS2005和MATLAB都装在D:\ProgramFile目录下,我制作.NET组件时,总是提示找不到CSC.EXE这个命令,这个我该怎么设置?
盼指教,谢谢
[ 本帖最后由 gzzjq 于 2006-10-27 20:20 编辑 ] 目前项目需要应用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 /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: 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?(/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 /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: 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?(/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++编译器配置成功!
[ 本帖最后由 happy 于 2006-10-24 19:48 编辑 ] 谢谢,我弄好了
主要是我的2006A只支持2003的CSC
现在我装好2006B,他就支持2005的CSC
我是作.NET组件,
在 2006A下作COM组件没问题 原帖由 happy 于 2006-10-24 19:47 发表
目前项目需要应用VS.net调用Matlab编译生成的COM组件。首先需要配置Matlab的C/C++编译器,由于我的VS.net并没有安装在C盘的根目录下,而在Matlab的命令行中输入mbuild -setup和mex -setup命令时,若选择mbuild to ...
我的怎么还是不行呢?
我的是按照您说的弄的啊,我的VS2005装在D:\Program Files\Microsoft Visual Studio 8
Matlab装在D:\Matlab下,在Matlab的命令行中输入mbuild -setup和mex -setup命令时,设置路径为D:\Program Files\Microsoft Visual Studio 8可是后面编译时还是出现类似错误,并提示找不到'cl',我后面在D:\Program Files\Microsoft Visual Studio 8\VC\bin下找到了这个文件,就把路径改成这个路径还是不行。
还请帮忙看看,是什么原因,谢谢了。 你看一下是不是这个问题
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) 就是这个问题,谢谢了。
不过我改了路径之后,问题还是没有解决。
我的问题是出现在用comtool编译是产生的(错误提示一样)。
我后面把mex-setup和mbuild-setup又重新设置了一下路径(先后改过D:\Program Files\Microsoft Visual Studio 8\VC\bin
,D:\Program Files\Microsoft Visual Studio 8\VC,和D:\Program Files\Microsoft Visual Studio 8)都不行。
还请校长再帮忙解决一下。
PS:我在一个帖子上看到有人是用dotnettool编译的(我在我的MATLAB上找不到这个文件),不知道是不是这个问题,我这两天才试着去编译M文件,什么都不懂。。 我和你遇到的问题一样,郁闷死我了,做了好久,我在我这里C:\Program Files\Microsoft Visual Studio 8\VC\bin下找到的CL文件,点击都不能运行,会出错,编译COM组件也提示:
Building standalone executable...
mcc -M -silentsetup -d 'C:/MATLAB6p5/work/comtest1/src'-B 'csglcom:comtest1,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.
有没有谁可以帮帮忙啊
页:
[1]