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.


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

linking netcdf on Linux (fwd)



 From: Matthew Bettencourt <address@hidden>
 To: Ben Foster <address@hidden>
 Cc: address@hidden
 Subject: Re: linking netcdf on Linux

 Try adding
 -Msecond_underscore
 to the compile and link lines.  That will make nf_strerror_ 
 nf_strerror__ which is what is std in the lib.  Do a google on g77 
 underscore and you will find a lot of docs on the great idea that the 
 g77 team had in adding underscores.   Ugh
 Matt

------- Forwarded Message

Date:    Mon, 12 May 2003 11:24:11 -0600
From:    Ben Foster <address@hidden>
To:      address@hidden
cc:      address@hidden
Subject: linking netcdf on Linux

--Business_of_Ferrets_593_000
Content-Type: TEXT/plain; charset=us-ascii
Content-MD5: h5Bcmqqi36z0SofBnc6Y0w==


Hi netcdf group:

We have installed netcdf 3.5 on a Linux system running RedHat 7.3.
I am using pgf90 4.0-2 to compile a small f90 code, and am getting
"undefined reference" errors:

(sundog) foster : gmake
pgf90 -c -I/opt/local/include rdmgcm.F
pgf90 -c -I/opt/local/include mkcdf.F
pgf90 -c -I/opt/local/include mkncfile.F
pgf90 -o mkcdf mkcdf.o  mkncfile.o      rdmgcm.o          -L/opt/local/lib 
-lnetcdf
mkncfile.o: In function `mkncfile_':
mkncfile.o(.text+0x110): undefined reference to `nf_create_'
mkncfile.o: In function `handle_ncerr_':
mkncfile.o(.text+0x77a): undefined reference to `nf_strerror_'
gmake: *** [mkcdf] Error 2
(sundog) foster : 

I am using #include "netcdf.inc" in mkncfile.F, and it is apparently
finding this file in /opt/local/include. The lib libnetcdf.a is in
/opt/local/lib, and it has both nf_create and nf_strerror.

I will attach the Makefile and mkncfile.F. Thanks for any suggestions,

--Ben



-----------------------------------------------------------------------
Ben Foster                      High Altitude Observatory (HAO)
address@hidden                  phone: 303-497-1595  fax: 303-497-1589  
Nat. Center for Atmos. Res.     P.O. Box 3000 Boulder CO 80307 USA
-----------------------------------------------------------------------

------- End of Forwarded Message