Friday, March 18, 2011

Configure Matlab to use Visual 2010 C/C++ compiler

By default Matlab 2009 have only a C compiler (mex file compiler).
It could detects the Visual compiler for the 2005/2008 version but not for the 2010 version.

Hopefully MathWorks have released a patch ;)

Link :


How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?

Problem Description:

I would like to use Visual C++ 2010 to create MEX files for use in MATLAB.


The Microsoft Visual C++ 2010 compiler is not supported on the released version of MATLAB 7.10 (R2010a), but support can be added by installing a patch. To install the patch:

1. Download the patch attached to this Solution. The patch includes files needed to support these combinations of MATLAB and Visual C++ 2010:
• Visual C++ 2010 Professional and 64-bit MATLAB 7.10 (R2010a)
• Visual C++ 2010 Professional and 32-bit MATLAB 7.10 (R2010a)
• Visual C++ 2010 Express (Windows SDK 7.1 also required) and 64-bit MATLAB 7.10 (R2010a)
• Visual C++ 2010 Express and 32-bit MATLAB 7.10 (R2010a)

2. Confirm that you are running MATLAB 7.10 (R2010a). You can check this using the About box available at Help->About MATLAB.

3. Unzip the contents of the patch into your MATLAB installation. This can be done from within MATLAB itself with the command:
unzip( path_to_zip_file, matlabroot);

4. Set up MEX to use Visual C++ 2010 with the command:

mex –setup Visual C++ 2010 should now be among the listed options.

Note that this patch will only work with MATLAB 7.10 (R2010a). Using this patch with any version of MATLAB is not supported.

Other MathWorks products such as Real-Time Workshop do not support Visual C++ 2010.

Source : MathWorks


  1. Excellent pieces. Keep posting such kind of information on your blog. I really impressed by your blog.
    Vee Eee Technologies| Vee Eee Technologies

  2. You are my life saver. God bless you.
    I work on MATLAB2009a. This platform also work with this patch.