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:
- A text editor for editing your ADMB code and input files,
- the ADMB program, which generates C++ code from your template file,
- a C++ compiler to create an executable program from the C++ code, and
- 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.
Notes
- ADMB no longer supports the Borland compiler.
- There is no need to set environment variables ADMB_HOME and MINGW_HOME any more.
- ADMB now compiles in safe mode by default, so use the –O switch when you have finished debugging to compile in optimized mode.
- 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 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
- Download mingw-get-setup.exe from the MinGW sourceforge website.
- Run the installer, accepting default options.
- In the Basic Setup, select the bin class of mingw32-base and mingw32-gcc-g++.
- (Optional) Also select mingw32-gcc-fortran if you want to compile your Fortran programs with gfortran.
- Select "Apply changes" in the installation menu.
Option B (if you don't need the Fortran compiler)
- Download gcc472-win32.zip from the ADMB Project website.
- 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)].
- Download admb-11.1-windows-mingw-32bit.exe from the ADMB Google Code website.
- Run the installer. Suggestion: at "Select destination folder", type C:\admb.
- 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. @echo For help, type command "admb".
- 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 simple
- (Recommended) Download the latest versions of the ADMB manuals from the ADMB Google Code website.
- Download and run cedt-286M-setup.exe from Sourceforge.net.
- Find the folder where it is installed, probably somewhere like C:\Program Files\Emerald Editor Community\Crimson Editor SVN286M.
- Save admb.key and admb.spc to the spec sub-folder.
- Save extension.tpl to the link sub-folder.