User`s guide
Differences Between MEX-Files and Stand-Alone Applications
4-3
For more information about distributing a C application, see “Distributing
Stand-Alone Applications” on page 4-27.
Note If you attempt to compile M-files to produce stand-alone applications
and you do not have the MATLAB C/C++ Math Library installed, the system
will not be able to find the appropriate libraries and the linking will fail. Also,
if you do not have the MATLAB C/C++ Graphics Library installed, the
MATLAB Compiler will generate run-time errors if the graphics functions are
called.
Stand-Alone C++ Applications
To build stand-alone C++ applications, MATLAB, the MATLAB Compiler, a
C++ compiler, and the MATLAB C/C++ Math Library must be installed on your
system.
The source code for a stand-alone C++ application consists either entirely of
M-files or some combination of M-files, MEX-files, and C or C++ source code
files.
The MATLAB Compiler, when invoked with the appropriate option flag (
-p or
-L Cpp), translates input M-files into C++ source code suitable for your own
stand-alone applications. After compiling this C++ source code, the resulting
object files are linked against the MATLAB C/C++ Math Library. For more
information about distributing a C++ application, see “Distributing
Stand-Alone Applications” on page 4-27.
Note On the PC, the MATLAB C++ Math Library is static because the
different PC compiler vendors use different C++ name-mangling algorithms.