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

[netCDF #UIX-707316]: problem in running fortran with netcdf4.1.3

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.


  • Subject: [netCDF #UIX-707316]: problem in running fortran with netcdf4.1.3
  • Date: Mon, 29 Oct 2012 16:43:04 -0600

Hi Xiaoguang Tan,

> We have a fortran program with netcdf 3.6.1 . It is no problem .
> We installed netcdf 4.1.3 and changed our old fortran program : from nf90_ to 
> nf_ ,
> from nf_put_var to nf_put_var_tex etc.
> We successfully compiled the program . But when we run the program, it shows 
> a error:
> "error while loading shared libraries: libnetcdf.so.7: cannot open shared 
> object file: No such file or directory"
> We can see libnetcdf.so.7 in our netcdf install directory. Why it cannot find 
> it ?
> While we have another fortran program which call netcdf of C can successfully 
> run .
> Why? We only use C with netcdf 4.1.3 ?

In 4.1.3, the Fortran library is a separate shred library, so you need to use 
two
library options to the compiler:

   -lnetcdff -lnetcdf

instead of just

   -lnetcdf

Also, you may need to set LD_LIBRARY_PATH to the directory where the netCDF 
libraries
are installed, to make sure the compiler can find them.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: UIX-707316
Department: Support netCDF
Priority: Normal
Status: Closed