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

[netCDF #EVI-889112]: Question regarding where function definitions are in netcdf



Hello Carlos,

You should not need to include the netcdf.h header, but you will need to link 
against the netcdf C library (libnetcdf.so).  The fortran interface, 
libnetcdff.so, is just a pass-through layer which translates fortran calls into 
C library functions.  The standard used for functions are `nc_` and `nf_`; 
`nf_` functions are provided by the fortran library, and in turn invoke the 
`nc_` functions provided by the C library.

I hope this helps!

-Ward

> 
> 
> Hello,
> 
> 
> We are running into a linking issue with MEGAN (a Fortran based program).  
> There seems to be a set of references which are not properly linking in (See 
> attached).  It looks like these references are originally defined in the 
> netcdf (C version) header includes.  Should we be trying to include these C 
> headers?  Or should those definitions be coming from a particular shared 
> library instead?
> 
> Based on the error output, it looks like the libnetcdff.a contains the 
> functions, just not the definitions (at least, not in a way that we are 
> expecting them)...
> 
> 
> Specific example of what we are questioning, more in out.txt[attached]:
> 
> /opt/pgi/linux86-64/16.3/bin/pgf90 -O2 -Mdalign -Mnoframe -byteswapio -Mlfs 
> -Bstatic_pgi -I/home/Bucaram/Documents2/ioapi-3.2/ioapi/fixed_src 
> -I/home/Bucaram/Documents2/netcdf-4.4.0/include  -o ioapi2uam ioapi2uam.o 
> -L/home/Bucaram/Documents2/ioapi-3.2/Linux2_x86pg_pgcc_nomp -lioapi 
> -L/home/Bucaram/Documents2/netcdf-fortran-4.4.3/lib64 -lnetcdff
> /home/Bucaram/Documents2/ioapi-3.2/Linux2_x86pg_pgcc_nomp/libnetcdff.a(nf_attio.o):
>  In function `nf_put_att_text_':
> /home/Bucaram/Documents2/netcdf-fortran-4.4.3/fortran/./nf_attio.F90:56: 
> undefined reference to `nc_put_att_text'
> 
> 
> Thank you for an insight into this matter.
> 
> 
> Carlos Bucaram
> 
> Graduate Research Assistant
> 
> Chemical Engineering Department
> 
> University of North Dakota
> 
> 
> 


Ticket Details
===================
Ticket ID: EVI-889112
Department: Support netCDF
Priority: Normal
Status: Closed