NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] Compiling netCDF in Fortran

On 29/07/2010, at 5:38 PM, Roy Mendelssohn wrote:

> Yes it goes into the options line.
> 
> The fink version compiles netcdf with an option set that puts the C libraries 
> in libnetcdf and the FORTRAN libraries in libnetcdff  (that is not a typo), 
> so you need both.  There are two -L's set, since the libraries live in 
> different locations.
> 
> The other errors have to do with options on how a compiler stores the names 
> of functions in libraries, and what you are compiling with does not use the 
> same options as what the libraries were compiled with.
> 
> I would suggest changing the g77 to gfortran in the make file.  If you still 
> get errors, could you give which version of the Mac OS you have, as well as 
> do the following in the terminal and give the results:
> 
> which gfortran
> 
> gfortran --version
> 
> fink --version

Roy,

Thank you for the clarification.  Those details (like netcdf and netcdff) I 
would have never known in a million years...

I also had no idea I had gfortran and g77 installed.  

Anyway, this set up worked:

==============================
F77         =  gfortran
OBJ         =  most3_x
SRC         =  most3_nc_x.f offtime.f timestep.f swlon.f swlat.f swrun03.f 
surf_read.f surf_run.f rgrd1.f rgrd2.f
OPT = -O -I/sw/lib/netcdf-gfortran/include -L/sw/lib -lnetcdf  
-L/sw/lib/netcdf-gfortran/lib  -lnetcdff

$(OBJ):  $(SRC)
        $(F77) $(SRC) $(OPT) -o $(OBJ)
==============================

IT seems like the code is now running.  I will do a few tests and let you know.

Thanks again,

-jose






  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: