MATLAB: How to disable the unsupported compiler warning message generated by the MEX command in MATLAB 7.13 (R2011b)

gcclinuxmacMATLABsolarisversionwrong

I am using GCC 4.4.1, which is an unsupported compiler for MATLAB 7.13 (R2011b). When I type the following command in MATLAB
mex yprime.c
I receive a warning message:
Warning: You are using gcc version "4.4.1". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
<http://www.mathworks.com/support/compilers/current_release/>
I tried to disable this warning using the following MATLAB command
warning off last
but receive an error message:
Error using warning
The last warning issued had an empty warning identifier, or no
warnings have yet been issued.
I would like to disable this warning message.

Best Answer

The ability to suppress this warning message is not available inside MATLAB.
To work around this issue,
1. Open the file named "mex" found in the $MATLABROOT/bin directory, where $MATLABROOT is the MATLAB root directory on your machine, as returned by executing the following at the MATLAB Command Prompt:
matlabroot
2. Navigate to Lines 402-409 of the file. The error message is being printed from the if-statement contained on these lines:
if (need_to_warn == 1)
{
printf("\n");
printf("Warning: You are using gcc version \"%s\". The version\n", version_number);
printf(" currently supported with %s is \"%s\".\n", toolName, versions[2]);
printf(" For a list of currently supported compilers see: \n");
printf(" <http://www.mathworks.com/support/compilers/current_release/\n\n http://www.mathworks.com/support/compilers/current_release/\n\n">);
}
Commenting the above lines of code will suppress the warning in MATLAB.
Related Question