User`s manual
Custom Building MEX-Files
1-23
mex uses the first occurrence of the options file it finds. If no options file is 
found, 
mex displays an error message. You can directly specify the name of the 
options file using the 
-f switch.
For specific information on the default settings for the MATLAB supported 
compilers, you can examine the options file in 
<matlab>/bin/mexopts.sh, or 
you can invoke the 
mex script in verbose mode (-v). Verbose mode will print the 
exact compiler options, prelink commands (if appropriate), and linker options 
used in the build process for each compiler. “Custom Building on UNIX” on 
page 1-24 gives an overview of the high-level build process.
Default Options File on Windows
The default MEX options file is placed in your user profile directory after you 
configure your system by running 
mex -setup. The mex script searches for an 
options file called 
mexopts.bat in the following order:
•The current directory
•The 
user profile directory. See the following section, “The User Profile 
Directory”, for more information about this directory
•
<matlab>\bin\win32\mexopts
mex
 uses the first occurrence of the options file it finds. If no options file is 
found, 
mex searches your machine for a supported C compiler and 
automatically configures itself to use that compiler. Also, during the 
configuration process, it copies the compiler’s default options file to the 
user 
profile
 directory. If multiple compilers are found, you are prompted to select 
one.
For specific information on the default settings for the MATLAB supported 
compilers, you can examine the options file, 
mexopts.bat, or you can invoke the 
mex script in verbose mode (-v). Verbose mode will print the exact compiler 
options, prelink commands, if appropriate, and linker options used in the build 
process for each compiler. “Custom Building on Windows” on page 1-26 gives 
an overview of the high-level build process.
The User Profile Directory
The Windows user profile directory is a directory that contains user-specific 
information such as desktop appearance, recently used files, and 
Start menu 
items. The 
mex and mbuild utilities store their respective options files, 
mexopts.bat and compopts.bat, which are created during the –setup process, 










