在matlab中创建exe文件的问题

时间:2012-09-30 11:49:53

标签: matlab compiler-construction compiler-errors exe matlab-deployment

这是在matlab 7.1中构建exe文件的会话。

我认为编译器存在问题。

mbuild -setup

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


Select a compiler: 
[1] Microsoft Visual C++ 2008 Express in C:\Program Files (x86)\Microsoft Visual Studio 9.0 

[0] None 

Compiler: 1


Please verify your choices: 

Compiler: Microsoft Visual C++ 2008 Express  
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0 

Are these correct [y]/n? y

***************************************************************************** 
Error: Could not find the 64-bit compiler.  This may indicate that the  
     "X64 Compilers and Tools" or the Microsoft Windows Software  
     Development Kit (SDK) is not installed.  To build 64-bit binaries,  
     Microsoft Visual C++ 2008 Express Edition requires that these two  
     packages be properly installed.  
***************************************************************************** 

Trying to update options file: C:\Users\****\AppData\Roaming\MathWorks\MATLAB\R2010a\compopts.bat 
From template:              C:\PROGRA~1\MATLAB\R2010a\bin\win64\mbuildopts\msvc90freecompp.bat 

Done . . . 

>> mcc -m mainmain.m -o mainmain
Could not find the compiler "cl" on the DOS path. 
Use mbuild -setup to configure your environment properly. 


C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: Unable to locate compiler. 

Error: An error occurred while shelling out to mbuild (error code = 2). 
Unable to build executable (specify the -v option for more information). 
??? Error using ==> mcc
Error executing mcc, return status = 1 (0x1).

如果问题出在编译器上,我该如何安装另一个编译器?

我有Windows 7(64位),我希望exe文件可以在Windows操作系统上运行。

1 个答案:

答案 0 :(得分:1)

这可能是两个问题之一的结果。

1)您没有安装Windows SDK(如错误消息中所示)。根据此MathWorks page关于支持的编译器

  

必须安装Microsoft Visual Studio 2008和Windows软件开发工具包(SDK)6.1。安装Microsoft Visual Studio时,必须在安装Microsoft Visual Studio时选择“X64编译器和工具”;默认情况下不会选中此项。

现在,请记住,此引用是针对最新版本的MATLAB,但我认为此信息仍与您的问题相关。

您可以下载SDK here

2)您的MATLAB版本也可能不支持您正在使用的编译器。有关MATLAB 7.1支持的编译器的信息,请参阅here