This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Jim, > To: address@hidden > cc: address@hidden > From: Chim Kin Sang <address@hidden> > Subject: Fortran compile problem > Organization: . > Keywords: 199612300835.BAA24891 In the above message you wrote: > I try to write my own code on accessing the netCDF file. I have > follow the instruction to install the netCDF. But when I compile it. The > error message come out. Can you give me a hand. > > Following is my testing code > cccccc > c access.f > c > c To access the aws data in netcdf format > cccccc > include 'netcdf.inc' > c > c > c NCID : ID for netCDF file > c NDIMS : ID for dimensions > c NVARS : ID for variables > c NGATTS : no. of global attributes defined for the variable > c RECDIM : ID for unlimited dimension > c RCODE : return error code, 0=no error > integer NCID,NDIMS,NVARS,NGATTS,RECDIM,RCODE > c > c open a netcdf fiel for access > c > NCID=NCOPN('aws.940703.000000.cdf', NCNOWRIT, RCODE) > c > c inquire about the opened netCDF file > c > call NCINQ(NCID,NDIMS,NVARS,NGATTS,RECDIM,RCODE) > c > write(*,*)'NCID=',NCIDf77 access.f > write(*,*)'NDIMS=',NDIMS > write(*,*)'NVARS=',NVARS > write(*,*)'NGATTS=',NGATTS > write(*,*)'RECDIM=',RECDIM > write(*,*)'RCODE=',RCODE > c close the netCDF file > c > call NCCLOS(NCID,RCODE) > c > end > > > - -------------------------------------------------------------- > And the error message is > > f77 access.f > ld: > Unresolved: > ncopn_ > ncinq_ > ncclos_ > > It seems that I have some path name or some file haven't been > installed. But I cannot find the problem. Moreover, did the netcdf.inc > include statement got mistake? > > Thanks > Jim It appears that the linker couldn't find the netCDF FORTRAN routines. This is probably because the command to link your program together didn't reference the netCDF library. On a UNIX system, this is usually done via the `-L' and `-l' options to the linker or compiler. For example: cc myprog.o -L/usr/local/netcdf/lib -lnetcdf Please let me know if this helps. -------- Steve Emmerson <address@hidden>