matlabcompiler-errorsexematlab-deployment

problems with creating an exe file in matlab


this is the session of building exe file in matlab 7.1.

I think I have a problem with the compiler.

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).

if the problem is with the compiler, how can I install another compiler?

I have windows 7 (64 bits) and I want that the exe file will work on windows operating system.


Solution

  • This is probably the result of one of two issues.

    1) You don't have the Windows SDK installed (as indicated in the error message). According to this MathWorks page regarding supported compilers

    Both Microsoft Visual Studio 2008 and Windows Software Development Kit (SDK) 6.1 must be installed. When installing Microsoft Visual Studio, you must choose "X64 Compilers and Tools" when installing Microsoft Visual Studio; this is not selected by default.

    Now, keep in mind, this reference is for the most recent release of MATLAB, but I'm betting that this information is still relevant to your issue.

    You can download the SDK here.

    2) It's also possible that the compiler that you're using simply isn't supported for your release of MATLAB. See here for info on supported compilers for MATLAB 7.1.