Configuring MEX: mex -setup

If you've just installed the MATLAB or have never used MEX before, you have to configure MEX so that it knows which C/C++ (or FORTRAN) compiler it's supposed to use. A list of supported compilers can be found in Tech-Note 1601. When you run "mex -setup", it does the following:

Here's a sample session of "mex -setup" in MATLAB 5.3 that was used to set up MSVC++ compiler version 5.0:
Please choose your compiler for building external interface (MEX) files.

Would you like mex to locate installed compilers?([y]/n): n

Choose your C compiler:
[1] Borland C          (version 5.0, 5.2, or 5.3)
[2] Microsoft Visual C (version 4.2, 5.0, or 6.0)
[3] Watcom C           (version 10.6 or 11)
[4] Lcc C              (C compiler bundled with MATLAB)

Or choose a Fortran compiler:
[5] DIGITAL Visual Fortran (version 5.0)

[0] None

Compiler: 2

Choose the version of your C compiler:
[1] Microsoft Visual C 4.2
[2] Microsoft Visual C 5.0
[3] Microsoft Visual C 6.0

version: 2

Your machine has a Microsoft Visual C compiler located at D:\MSVC_50.
Do you want to use this compiler?([y]/n): n
Please enter the location of your C compiler: [D:\MSVC_50] d:\Applications\DevStudio

Please verify your choices:

Compiler: Microsoft Visual C 5.0
Location: d:\Applications\DevStudio
Are these correct?([y]/n): y

The default options file:
"C:\WINNT\Profiles\shirwani\Application Data\MathWorks\MATLAB\mexopts.bat"
is being updated...
d:\R11.1\work>



How do I check if I've done "mex -setup" correctly?
Try to compile and run $MATLAB/extern/examples/mex/yprime.c


Back to Table of Contents