首先在matlab中输入:
mbuild-setup
然后会显示几个存在的编译器(如vc)
但是选择其中一个后,会有问题,如下:
Usage:
MBUILD [option1 ... optionN] sourcefile1 [... sourcefileN]
[objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN]
[exportfile1 ... exportfileN]
Use the -help option for more information, or consult the MATLAB Compiler
User's Guide.
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: No file names given.
Undefined function or variable 'setup'.
这是因为mbuild 和-setup中间应该加个空格:
所以正确的输入为:
>> mbuild -setup
Welcome to mbuild -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2012a/win32.html
Please choose your compiler for building shared libraries or COM components:
Would you like mbuild to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2012a\sys\lcc
[2] Microsoft Visual C++ 2010 in C:\Program Files\Microsoft Visual Studio 10.0
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: C:\Program Files\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
****************************************************************************
Warning: Applications/components generated using Microsoft Visual C++
2010 require that the Microsoft Visual Studio 2010 run-time
libraries be available on the computer used for deployment.
To redistribute your applications/components, be sure that the
deployment machine has these run-time libraries.
****************************************************************************
Trying to update options file: C:\Users\dong\AppData\Roaming\MathWorks\MATLAB\R2012a\compopts.bat
From template: C:\PROGRA~1\MATLAB\R2012a\bin\win32\mbuildopts\msvc100compp.bat
Done . . .
>>
低版本的matlab可以输入 :
comtool
但是高版本中comtool被deploytool所替代,所以输入
>> comtool
Undefined function or variable 'comtool'.
所以应该输入:
deploytool
com编译器就会出现了~~
也可以在菜单中打开编译器的:
file 》new 》deployment project