Example code and module definition to use the EPANET toolkit from FORTRAN.

How to build the example

The example was developed using gfortran 4.7.0 (32bit) and MinGW on Windows and tested with gfortran 4.8.1 on a 64bit Linux system. Other compilers/operating systems may need small adjustments (e.g. in the Makefile).

  1. To install MingGW, follow Getting Started instructions
  2. Open a MinGW shell
  3. Run mingw-get install gfortran
  4. Get the epanet-fortran source code
  5. To build the example: make
  6. To run the example: ./epanet_fortran_example.exe


The code uses iso_c_binding, an intrinsic module defined in FORTRAN 2003. Therefore a FORTRAN 2003 compiler with a compatible C compiler and linker are required in order to use the epanet-fortran module. When linking the code, remember to link against the C math library (gcc/gfortran option -lm), because the EPANET C code uses functions from that library.

Source code

Source code is available on Github: epanet-fortran.

If you've succeeded building the code with a different compiler, it would be great if you would share your Make/build files.

Troubleshooting and support

Use of the issue tracker is the preferred way to obtain support regarding epanet-fortran related issues. If that doesn't suit you, please send an email.