File Exchange

image thumbnail

howto: mex + MS Visual C/C++ Express Edition 2005

version 1.0 (85.4 KB) by

Describes steps to set up the free Visual C/C++ Express Edition 2005 compiler as mex backend

13 Ratings



No License

Steps for how to install the 2005 Express Edition Visual C/C++ as the backend mex compiler. This document is for you if:

You want to compile C mex files using the free Microsoft Visual C/C++ compiler that comes with Visual Studio 2005 Express Edition.

You want to be able to compile your mex file using the Matlab command line tool mex, rather than creating projects and compiling within the Visual Studio IDE.

You want to do this with zero hacking on the mex installation or on any mexopts.bat files.

Comments and Ratings (15)


GIGA (view profile)

the file does not exit

C. Peng

2007b with VC 2008 express, successful, thank you!

I successfully configured Microsoft Visual C++ 2008 Express Edition for version 2006a using the instructions given. Thank you so much for sharing this info.

Richard Register

Confirmed that Visual C++ 2008 Express works with Matlab 2008a (v7.6.0) by following these instructions.
The final step, running mex -setup, had no trouble finding the Visual C++ 2008 express compiler and mex is working for me now. Thank you!

Alf-Peter Elg

Jeroen Sabbe

Thank you so much for this extremely clear document! I have Matlab R2007a and wanted to use CPLEXINT ( to link with CPLEX, but I couldn't get the files compiled with lcc. Thanks to your document, I could compile them with MS C++ Compiler and things worked perfectly. Thank you so much!

Fawad Muzaffar

I was able to configure Matlab R 2007b with Visual C++ 2008 using the step by step procedure. Thank you for uploading this file

Sivarama Venkatesan

Very helpful. Thank you for the painstaking effort to document all the steps so clearly. I used your procedure with Matlab R2007b and Microsoft Visual C++ 2008 Express Edition, and it worked perfectly.

Will Fox

As of the 2007a release, Matlab/mex now recognizes VC 2005 Express Edition as a supported compiler. Unfortunately, in the process they made changes which break the steps set out in the how-to, which was devised based on 2006a/b. (I believe the last post was referring to this fact.)

You still need to install VC Express and the Platform SDK (though the exact location of the latter may no longer be important).
CRITICAL: 2007a requires the Windows environment variable "MSSdk" which must contain the path to the SDK. A handy test to see which windows environment variables Matlab sees is to do
>> !set
at the Matlab prompt.

For reference, you can see, in particular footnote 1.

I will update the how-to once I can get a copy of 2007a and test everything myself. Please email me with any questions in the meantime.

Anthony Faucogney

This seems to be great, but it doesn't work for me. I use Matlab 2007a and unfortunatly nothing is is working. When I type mex-setup and chose the [2]visual C++ 2005 Espress, and I still get error about unknow MSSDK....

Ewan Fitzsimons

Or you could just edit the 'mssdk' environment variable to wherever you install the Platform SDK, and Matlab will look for it there

Fang Yu

This solves my mex compiling problem.

Jim Lasswell

Thank you for the advice.

good advice

wish i had read this before using the mex command... i think the moral is to right your own options file for mex so you can understand what directories to include, etc.

one satisified reader

Using this free compiler solved all the problems I was having with that native matlab C compiler Lcc.


Updating the requirements to say that the how-to only works for 2006a/b, not 2007a.

MATLAB Release
MATLAB 7.3 (R2006b)

Inspired: Image Aquisition, ARFIMA(p,d,q) estimator

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today