Using the C++ Math Library    

Building an Application 

There is C++ source code for example ex1.cpp included in the
<matlab>/extern/examples/cppmmath directory, where <matlab> represents the top-level directory where MATLAB is installed on your system. To verify that mbuild is properly configured on your system to create stand-alone applications, copy ex1.cpp to your local directory and cd to that directory. Then, at the UNIX prompt, enter:

This should create the file called ex1. Stand-alone applications created on UNIX systems do not have any extensions. If you have a problem using mbuild, see Troubleshooting mbuild.

Locating Shared Libraries

Before you can run your stand-alone application, you must tell the system where the API and C++ shared libraries reside. This table provides the necessary UNIX commands depending on your system's architecture.

Architecture
Command
HP700
setenv SHLIB_PATH <matlab>/extern/lib/hp700:<matlab>/bin/hp700:$SHLIB_PATH
IBM RS/6000
setenv LIBPATH <matlab>/extern/lib/ibm_rs:<matlab>/bin/ibm_rs:$LIBPATH
All others
setenv LD_LIBRARY_PATH <matlab>/extern/lib/<arch>:<matlab>/bin/<arch>:$LD_LIBRARY_PATH

where:

  <matlab> is the MATLAB root directory
  <arch> is your architecture (i.e., alpha, glnx86, sgi, sol2)

It is convenient to place this command in a startup script such as
~/.cshrc. Then, the system will be able to locate these shared libraries automatically, and you will not have to re-issue the command at the start of each login session. The best choice is to place the libraries in ~/.login, which only gets executed once.

Running Your Application

To launch your application, enter its name on the command line. For example,


 Configuring the Build Environment mbuild Options