MATLAB: Does the MEX -SETUP command not list the g++ compiler in LINUX

-setupcompilerfileg++linuxMATLABmexoptionsr2007bunix

I was trying to setup the compiler to compile C++ mex-files. I installed the MATLAB in my HOME directory and I see that I have a g++ compiler supported for this version is installed on my computer, but the problem is when I use the command mex -setup, it is not able to find the g++ compiler on my machine. Its finding only the in-built compilers with MATLAB. I don't know if I may need to set the path somewhere to find the g++ compiler on my computer.

Best Answer

In UNIX platforms, "mex -setup" lists only the options file for the installed compilers unlike in Windows platform where the entire set of compilers are listed. In your case, selecting the gcc option will enable MATLAB to pick up the corresponding options file gccopts.sh which then enables MEX to select the g++ compiler installed in your machine.
Note that MEX also automatically confirms if the installed compiler version is supported by MATLAB 7.4 (R2007b).
To see the list of supported compilers in R2007b, visit here:
To determine the version of compiler you are using, see the Related Solution below.
Related Question