4.5

4.5 | 12 ratings Rate this file 223 downloads (last 30 days) File Size: 85.42 KB File ID: #13321

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

by William Fox

 

09 Dec 2006 (Updated 01 Aug 2007)

No BSD License  

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

Download Now | Watch this File

File Information
Description

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.

Acknowledgements
This submission has inspired the following:
Image Aquisition
MATLAB release MATLAB 7.3 (R2006b)
Other requirements This file has been updated to encompass Matlab 2006a/b and R2007a.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (13)
18 Jan 2007 one satisified reader

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

07 Feb 2007 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.

23 Mar 2007 Jim Lasswell

Thank you for the advice.

12 Apr 2007 Fang Yu

This solves my mex compiling problem.

16 May 2007 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

31 May 2007 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....

05 Jul 2007 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 http://www.mathworks.com/support/tech-notes/1600/1601.html, 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.

20 Dec 2007 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.

02 Feb 2008 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

27 Mar 2008 Jeroen Sabbe

Thank you so much for this extremely clear document! I have Matlab R2007a and wanted to use CPLEXINT (http://control.ee.ethz.ch/~hybrid/cplexint.php) 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!

16 Apr 2008 Alf-Peter Elg  
28 Aug 2008 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!

05 May 2009 Sunish George

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

Please login to add a comment or rating.
Updates
05 Jul 2007

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

01 Aug 2007

Updated howto for R2007a.

Tag Activity for this File
Tag Applied By Date/Time
whitepaper William Fox 22 Oct 2008 08:51:44
article William Fox 22 Oct 2008 08:51:44
paper William Fox 22 Oct 2008 08:51:44
mex William Fox 22 Oct 2008 08:51:44
express 2005 William Fox 22 Oct 2008 08:51:44
visual c William Fox 22 Oct 2008 08:51:44
compiler William Fox 22 Oct 2008 08:51:44
express 2005 on62 on62 03 Jan 2009 23:23:52
mex on62 on62 03 Jan 2009 23:23:58
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com