MATLAB: How to compile the simple GUI or graphical application using the MATLAB Compiler

applicationcompilecompilergraphicgraphicalgraphicsguiMATLAB Compilerprogram

When I compile my application with the following command:
mcc -m myGuiApp
I receive a lot of errors and warnings similar to these:
Warning: File: legend Line: 694 Column: 13
References to "handle" will produce a run-time error because it is an undefined function or variable.
Warning: File: legend Line: 656 Column: 8
References to "graph2d" will produce a run-time error because it is an undefined function or variable.
Warning: File: legend Line: 1705 Column: 17
The MATLAB Compiler does not currently support MATLAB object-oriented programming.
References to the method "domethod" will produce a run-time error.
Warning: File: c:\matlab6p5\toolbox\matlab\graph2d\legend.m Line: 1841 Column: 14
References to "get" require the C/C++ Graphics Library when executing in stand-alone mode.
You must specify -B sgl or -B sglcpp in order to use the C/C++ Graphics Library.
Also, if using the -W option, you must specify either the mainhg or libhg wrapper type.
A run-time error will occur if the C/C++ Graphics Library is not present when "get" is called.
I looked around in the documentation but not could determine why I receive these errors.

Best Answer

This issue has been fixed in the MATLAB Compiler 4.0 (R14). If you are using a previous version, please read the following:
The correct way to compile an MATLAB file that uses graphics is to specify that you want to include the graphics libraries when compiling. This is done using the '-B sgl' flag with the MCC command (or '-B sglcpp' for C++):
mcc -B sgl myGuiApp
Although the warning messages above mention object-oriented programming, the correct problem is the missing graphics libraries in this case.