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.
Mekonnen, >Date: Mon, 24 Jun 2002 10:34:57 -0500 >From: "Mekonnen G. Woldemariam" <address@hidden> >Organization: University of Iowa >To: Steve Emmerson <address@hidden> >Subject: RE: 20020624: compiling UDUNITS-using readgeneral.f >Keywords: 200206202043.g5KKhRa05810 The above message contained the following: > Steve, > > Thanks again for your help. > (1) Is that /usr/bin/f77? > > Yes. > > (2) #ifndef PTR > > What is it in yours? > > If you change "ifndef PTR" to "if ! defined(PTR)" do you still get the > same error? > > Mine is also #ifndef PTR. I changed it to "#if ! defined(PTR)", but I still > got the same error message. > > (3)It would help if I could see the compilation command-line that you're > using to compile readgeneralF. > > f77 readgeneral.F -lnetcdf -ldunits > > (4) I just thought to give you access to my machine, in case you want > to check somethings by yourself. > machine name: x > user's name: x > password: x > > The file readgeneral.F and the directory udunits-1.11.7 are placed in this > directory: > > home/woldemar/cdc_execution > > Thank you very much, > Mekonnen By modifying the file readgeneral.F and using certain options on the f77 command-line, I was able to obtain the following: $ f77 -Wno-globals -Iudunits-1.11.7/include -Inetcdf-3.5.0/include readgeneral.F -Lnetcdf-3.5.0/lib -lnetcdf -Ludunits-1.11.7/lib -ludunits readgeneral.F: In program `MAIN__': readgeneral.F:116: warning: print*,x(2,2),x(72,36),ny,nm,nd,nh ^ Array element value at (^) out of defined range readgeneral.F:116: warning: print*,x(2,2),x(72,36),ny,nm,nd,nh ^ Array element value at (^) out of defined range readgeneral.F: In subroutine `gridread': readgeneral.F:255: warning: call unpack(idata,x,xscale,xoff,miss,ilon,jlat) ^ Reference to unimplemented intrinsic `UNPACK' at (^) (assumed EXTERNAL) /tmp/cccMszSH.o: In function `MAIN__': /tmp/cccMszSH.o(.text+0x35): undefined reference to `ncopn_' /tmp/cccMszSH.o(.text+0x58): undefined reference to `ncvid_' /tmp/cccMszSH.o: In function `gridread_': /tmp/cccMszSH.o(.text+0x390): undefined reference to `ncvid_' /tmp/cccMszSH.o(.text+0x3c1): undefined reference to `ncainq_' /tmp/cccMszSH.o(.text+0x3f1): undefined reference to `ncagtc_' /tmp/cccMszSH.o(.text+0x434): undefined reference to `ncpopt_' /tmp/cccMszSH.o(.text+0x45a): undefined reference to `ncagt_' /tmp/cccMszSH.o(.text+0x480): undefined reference to `ncagt_' /tmp/cccMszSH.o(.text+0x4a6): undefined reference to `ncagt_' /tmp/cccMszSH.o(.text+0x593): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0x5ea): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0x616): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0x659): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0x70f): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0x766): more undefined references to `ncvgt_' follow /tmp/cccMszSH.o: In function `timeindex_': /tmp/cccMszSH.o(.text+0xa6d): undefined reference to `ncdid_' /tmp/cccMszSH.o(.text+0xa9f): undefined reference to `ncdinq_' /tmp/cccMszSH.o(.text+0xae6): undefined reference to `ncvid_' /tmp/cccMszSH.o(.text+0xb1a): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0xb48): undefined reference to `ncagtc_' /tmp/cccMszSH.o(.text+0xc96): undefined reference to `ncpopt_' /tmp/cccMszSH.o(.text+0xcc4): undefined reference to `ncagtc_' /tmp/cccMszSH.o(.text+0xd05): undefined reference to `ncagt_' /tmp/cccMszSH.o(.text+0xe9d): undefined reference to `ncpopt_' /tmp/cccMszSH.o(.text+0x16f3): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0x17c1): undefined reference to `ncvgt_' /tmp/cccMszSH.o(.text+0x1934): undefined reference to `ncvgt_' collect2: ld returned 1 exit status Basically, I corrected the "include" statements in readgeneral.F and also removed all declarations of the UDUNITS functions. The file still has some problems that are not related to the UDUNITS package that you'll have to fix. The "undefined reference" errors are due to the fact that the netCDF library (netcdf-3.5.0/lib/libnetcdf.a) doesn't contain the Fortran-77 interface. Therefore, I rebuilt and reinstalled your netCDF package using the following settings in order to obtain the Fortran interface: CC=/usr/bin/gcc CPPFLAGS=-Df2cFortran FC=/usr/bin/f77 FFLAGS=-Wno-globals CXX=/usr/bin/g++ The result is the following: [woldemar@trmm2 cdc_execution]$ !f77 f77 -Wno-globals -Iudunits-1.11.7/include -Inetcdf-3.5.0/include readgeneral.F -Lnetcdf-3.5.0/lib -lnetcdf -Ludunits-1.11.7/lib -ludunits readgeneral.F: In program `MAIN__': readgeneral.F:116: warning: print*,x(2,2),x(72,36),ny,nm,nd,nh ^ Array element value at (^) out of defined range readgeneral.F:116: warning: print*,x(2,2),x(72,36),ny,nm,nd,nh ^ Array element value at (^) out of defined range readgeneral.F: In subroutine `gridread': readgeneral.F:255: warning: call unpack(idata,x,xscale,xoff,miss,ilon,jlat) ^ Reference to unimplemented intrinsic `UNPACK' at (^) (assumed EXTERNAL) You'll still have to fix some problems in readgeneral.F -- but you're well on your way. Regards, Steve Emmerson <http://www.unidata.ucar.edu>