[netcdfgroup] Compiling netCDF in Fortran

Hello everyone,

I am sure this an incredibly basic question, but maybe someone can tell me what 
i am doing wrong.  I am pretty hopeless in this regard.

I have a FORTRAN code that writes data out to netCDF files.  It is old, but it 
works...

The code compiles using a makefile that calls various netCDF libraries. 

I am using the g77 compiler that i installed via fink

the makefile looks like this:

=================================
F77         =  g77
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/netcdf-gfortran/include -lnetcdf

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

the error I get looks like this:


=================================
ld: library not found for -lnetcdf
collect2: ld returned 1 exit status
make: *** [most3_x] Error 1
=================================

so what i can;t figure out is what file is the compiler looking for? I have 
installed the netCDF packages using fink on my macbook (10.6.4).  It is 
obviously looking for a library file, but what it its exact name? and where 
might i find it? I have searched around in the usual places, i.e. places where 
fink puts things, i.e. in the /sw directories.

This same set up works on my older macs (10.4.xx) and things worked by just 
altering the paths in the lines above.  But now, on this newer set up, I can't 
seem to get the right bits talking to each other.

I have tried adding various paths after the -l flag in the OPT line above, but 
it gets me to the same place.

Can someone tell me fundamentally what that OPT line in the make file is doing? 
 why is there a path before the include file? but not before the library file?

What is the -I flag and what is the -L flag?  (I am guessing Include and 
Library, but then why -l?)

Anyway, any help/suggestions appreciated.

-jose



--
Jose C. Borrero
Adjunct Assistant Professor
University of Southern California 
Tsunami Research Center
http://www.usc.edu/dept/tsunamis




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