[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20030506: compiling netCDF-using Fortran code



Zahra,

> To: <address@hidden>
> From: "Zahra Bouya" <address@hidden>
> Subject: help
> Organization: UNSW

The above message contained the following:

> I have a fortran code to read netcdf data, but couldn't use the netcdf =
> library. could you please help me on how to compile my code using netcdf =
> library.
> thank you
> Zahra Bouya

Answering such a general question is difficult, but, in general, if
the netCDF package was installed in the directory "opt/netcdf" and you
wanted to compile the Fortran-77 program "foo.F", then you would execute
something like the following command:

    f77 -c -I/opt/netcdf/include foo.F

where "/opt/netcdf/include" is the pathname of the directory that
contains the netCDF Fortran header-file "netcdf.inc".

To link the program "foo", you would, in general, execute something like
the following command:

    f77 -o foo foo.o -L/opt/netcdf/lib -lnetcdf

where "/opt/netcdf/lib" is the pathname of the directory that contains
the netCDF library "libnetcdf.a".

There might be someone at your school who could help you with the
specific details of your computer system.

Regards,
Steve Emmerson