Compiling a Program


General Instructions To Compile A Program:

C:
    cc -o < your program> < your program>.c\ 
       -I< path for hdf include directory>\
       -L< path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
 or
    cc -o < your program> < your program>.c\ 
       -I< path for hdf include directory> \
          < path for libmfhdf.a> < path for libdf.a> \
          < path for libjpeg.a> < path for libz.a>

FORTRAN:
    f77 -o < your program> < your program.f>  \
        -L< path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
 or
    f77 -o < your program> < your program.f>  \
          < path for libmfhdf.a>  < path for libdf.a> \
          < path for libjpeg.a> < path for libz.a>
NOTE: The order of the libraries is important: libmfhdf.a first, followed by libdf.a, then libjpeg.a and libz.a. The libjpeg.a library is optional.

Additional options used to compile a program for a given platform are located in the configuration files (mh-*) in the HDF source code under ./config (for example, ./config/mh-hpux).

The ./release_notes/compile.txt gives information on compiling for each platform. This is based on the information in the configuration files.