Home > Notes


Setting up AD Model Builder

There are different ways of setting up AD Model Builder depending on your operating system (Windows/Linux/Mac), the C++ compiler you wish to use (GCC/Microsoft Visual C++/...) and whether you will compile the source code or install an appropriate binary distribution.

The essential requirements developing ADMB models are:

  1. A text editor for editing your ADMB code and input files,
  2. the ADMB program, which generates C++ code from your template file,
  3. a C++ compiler to create an executable program from the C++ code, and
  4. the system needs to know where to look for the ADMB and C++ compiler executables (System Path).

We will tackle these in reverse order.

The following instructions are for installing ADMB 11.1 on Windows (XP/7/...) for use with the GCC compiler. Compare with these instructions from the ADMB Project website.


  1. ADMB no longer supports the Borland compiler.
  2. There is no need to set environment variables ADMB_HOME and MINGW_HOME any more.
  3. ADMB now compiles in safe mode by default, so use the –O switch when you have finished debugging to compile in optimized mode.

Setting the System Path

There are different ways of doing this:

  • Add C:\MinGW\bin;C:\admb\bin to your System Path environment variable.
  • Each time you start a command prompt, enter
    set PATH=c:\MinGW\bin;C:\admb\bin
  • Let a batch file set the path for you, e.g. C:\admb\bin\set-admb-mingw.bat (see below).

MinGW—Minimalist GNU for Windows

MinGW is "a native Windows port of the GNU Compiler Collection (GCC)". It includes compilers for C++ and Fortran.

  • Option A installs a tool which will download and install the latest versions of the various packages which make up MinGW.
  • In option B one downloads a pre-packaged MinGW installation, which may be a better choice for installation on a computer with a limited internet connection.

Option A

  1. Download mingw-get-setup.exe from the MinGW sourceforge website.
  2. Run the installer, accepting default options.
  3. In the Basic Setup, select the bin class of mingw32-base and mingw32-gcc-g++.
  4. (Optional) Also select mingw32-gcc-fortran if you want to compile your Fortran programs with gfortran.
  5. Select "Apply changes" in the installation menu.

Option B (if you don't need the Fortran compiler)

  1. Download from the ADMB Project website.
  2. Unzip to C:\MinGW.

Test the installation by starting up a command prompt window and entering g++ –v — the compiler version should be displayed [e.g. gcc version 4.8.1 (GCC)].

AD Model Builder

Follow these steps:

  1. Download admb-11.1-windows-mingw-32bit.exe from the ADMB Google Code website.
  2. Run the installer. Suggestion: at "Select destination folder", type C:\admb.
  3. Replace the contents of C:\admb\bin\set-admb-mingw.bat with the following:
    @echo off
    @set PATH=C:\admb\bin;c:\admb\utilities;c:\MinGW\bin
    REM edit the line below as desired to set the initial directory
    @cd "%USERPROFILE%"
    @echo For help, type command "admb".
  4. Use the Start Menu shortcut ADMB command prompt to start up a command window with the enviroment variables correctly set. Test:
    cd \admb\examples\admb\simple
    admb simple
  5. (Recommended) Download the latest versions of the ADMB manuals from the ADMB Google Code website.

Setting up Crimson Editor for editing ADMB template files

  1. Download and run cedt-286M-setup.exe from
  2. Find the folder where it is installed, probably somewhere like C:\Program Files\Emerald Editor Community\Crimson Editor SVN286M.
  3. Save admb.key and admb.spc to the spec sub-folder.
  4. Save extension.tpl to the link sub-folder.