声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3908|回复: 6

[混合编程] 【已经解决】请教:如何配置C#编译器

[复制链接]
发表于 2006-10-23 10:38 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
我VS2005和MATLAB都装在D:\ProgramFile目录下,我制作.NET组件时,总是提示找不到CSC.EXE这个命令,
这个我该怎么设置?

盼指教,谢谢

[ 本帖最后由 gzzjq 于 2006-10-27 20:20 编辑 ]
回复
分享到:

使用道具 举报

发表于 2006-10-24 19:47 | 显示全部楼层
目前项目需要应用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组件不成功,出现如下错误提示:
error.jpg

解决方法如下:
>>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++编译器配置成功!

[ 本帖最后由 happy 于 2006-10-24 19:48 编辑 ]

评分

1

查看全部评分

 楼主| 发表于 2006-10-25 10:23 | 显示全部楼层
谢谢,我弄好了
主要是我的2006A只支持2003的CSC
现在我装好2006B,他就支持2005的CSC
我是作.NET组件,
在 2006A下作COM组件没问题
发表于 2006-10-27 10:47 | 显示全部楼层
原帖由 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下找到了这个文件,就把路径改成这个路径还是不行。
还请帮忙看看,是什么原因,谢谢了。
发表于 2006-10-27 11:06 | 显示全部楼层
你看一下是不是这个问题

http://www.mathworks.com/support ... p;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)
发表于 2006-10-27 11:43 | 显示全部楼层
就是这个问题,谢谢了。
不过我改了路径之后,问题还是没有解决。
我的问题是出现在用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文件,什么都不懂。。
发表于 2006-12-19 22:15 | 显示全部楼层
我和你遇到的问题一样,郁闷死我了,做了好久,我在我这里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.

有没有谁可以帮帮忙啊
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-14 22:01 , Processed in 0.070882 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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