| MATLAB Compiler | ![]() |
Configuration
This section describes how to configure a C or C++ compiler to work with the MATLAB Compiler. There is a MATLAB utility called mbuild that simplifies the process of setting up a C or C++ compiler. Typically, you only need to use the mbuild utility's setup option to initially specify which third-party compiler you want to use. For more information on the mbuild utility, see the mbuild reference page.
Introducing the mbuild Utility
The MathWorks utility, mbuild, lets you customize the configuration and build process. The mbuild script provides an easy way for you to specify an options file that lets you
The MATLAB Compiler (mcc) automatically invokes mbuild under certain conditions. In particular, mcc -m or mcc -l invokes mbuild to perform compilation and linking.
Configuring an ANSI C or C++ Compiler
Compiler Options Files
Options files contain flags and settings that control the operation of your installed C and C++ compiler. Options files are compiler-specific, i.e., there is a unique options file for each supported C/C++ compiler, which The MathWorks provides.
When you select a compiler to use with the MATLAB Compiler, the corresponding options file is activated on your system. To select a default compiler, use
Additional information on the options files is provided in this chapter for those users who may need to modify them to suit their own needs. Many users never have to be concerned with the inner workings of the options files and only need the setup option to initially designate a C or C++ compiler. If you need more information on options files, see Options Files.
Windows. Executing the command on Windows gives
mbuild -setup Please choose your compiler for building standalone MATLAB applications: Would you like mbuild to locate installed compilers [y]/n? n Select a compiler: [1] Borland C++Builder version 6.0 [2] Borland C++Builder version 5.0 [3] Borland C++Builder version 4.0 [4] Borland C++Builder version 3.0 [5] Borland C/C++ version 5.02 [6] Borland C/C++ version 5.0 [7] Borland C/C++ (free command line tools) version 5.5 [8] Lcc C version 2.4 [9] Microsoft Visual C/C++ version 7.1 [10] Microsoft Visual C/C++ version 7.0 [11] Microsoft Visual C/C++ version 6.0 [0] None Compiler: 11 Your machine has a Microsoft Visual C/C++ compiler located at D:\Applications\Microsoft Visual Studio. Do you want to use this compiler [y]/n? y Please verify your choices: Compiler: Microsoft Visual C/C++ 6.0 Location: D:\Applications\Microsoft Visual Studio Are these correct?([y]/n): y Try to update options file: C:\WINNT\Profiles\username\Application Data\MathWorks\MATLAB\R14\compopts.bat From template: \\sys\MATLAB\BIN\WIN32\mbuildopts\msvc60compp.bat Done . . . . . Updated ...
The preconfigured options files that are included with MATLAB for Windows are shown below.
UNIX. Executing the command on UNIX gives
mbuild -setup Using the 'mbuild -setup' command selects an options file that is placed in ~/.matlab/R14 and used by default for 'mbuild'. An options file in the current working directory or specified on the command line overrides the default options file in ~/.matlab/R14. Options files control which compiler to use, the compiler and link command options, and the runtime libraries to link against. To override the default options file, use the 'mbuild -f' command (see 'mbuild -help' for more information). The options files available for mbuild are: 1: <matlabroot>/bin/mbuildopts.sh : Build and link with MATLAB C-API or MATLAB Compiler-generated library via the system ANSI C/C++ compiler <matlabroot>/bin/mbuildopts.sh is being copied to /home/user/.matlab/R14/mbuildopts.sh
The preconfigured options file that is included with MATLAB for UNIX is mbuildopts.sh, which uses the system native ANSI compiler.
| Installing an ANSI C or C++ Compiler | Special Compiler Notes | ![]() |
© 1994-2005 The MathWorks, Inc.