MATLAB: Do I receive an error when compiling a MATLAB graphics application

_mclmainhgapplicationsc/c++compilecompilinggraphicslibraryMATLAB Compilerreferencetoundefined

I am having a problem compiling a stand-alone program that I wrote in MATLAB. The Engine of this file is a MATLAB function that calls a bunch of other files. I used the following MATLAB compiling command to create a stand-alone executable:
mcc -t -B sgl filenames.m
I believe I have the C Math Library, C Graphics Library, and other MATLAB libraries installed. However, I keep receiving the following error message:
undefined reference to '_mclMainhg'

Best Answer

This error occurs when the MATLAB C/C++ Graphics library is not properly installed.
You can verify if this is indeed the case by looking into the
$MATLAB/extern/examples folder
(where $MATLAB = the MATLAB root directory on your machine)
to see if a folder called "sgl" exists. If it does not exist, you do not have the MATLAB C/C++ Graphics Library and therefore will not be able to compile any MATLAB application that uses graphics.
You may purchase and install the MATLAB C/C++ Graphics Library product if you are using MATLAB 6.1 (R12.1) and earlier.
In MATLAB 6.5 (R13), the MATLAB Compiler tool is sold as an integrated product that includes the MATLAB C/C++ Graphics Library and the MATLAB C/C++ Math Library. Therefore, if you do not see the "sgl" folder in MATLAB 6.5 (R13), you will need to purchase and install the complete MATLAB Compiler product.
If you need more information about our product lines and specific information about any of our products you can visit http://www.mathworks.com/products/.
You may also send an email to our Pricing and Purchasing team at pricing@mathworks.com for more information about purchasing this product.