[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #FNE-136603]: error in using the netcdf library
- Subject: [netCDF #FNE-136603]: error in using the netcdf library
- Date: Sat, 18 Feb 2012 18:45:39 -0700
Hi,
> I have installed NetCDF 4.1.3 in the platform of CentOS 6.2 x86_64 with the
> compilers icc and ifort. The steps of the configure, make, testing and
> installation are seems all right. But when I tried to compiler the example
> "simple_xy_wr.f" using the following command:
>
>
>
> $ Ifort -o simple_xy_wr simple_xy_wr.f -lnetcdf
> -L/usr/netcdf-4.1.3-ifort/lib -I/usr/netcdf-4.1.3-ifort/include
With version 4.1.3, the netCDF Fortran and C libraries are separate, so I think
you need the following to link with the Fortran library as well as the C
library:
$ ifort -o simple_xy_wr simple_xy_wr.f -I/usr/netcdf-4.1.3-ifort/include
-L/usr/netcdf-4.1.3-ifort/lib -lnetcdff -lnetcdf
You can also use the nc-config command to show how to link a Fortran program.
Try
nc-config --all
and
nc-config --fflags --flibs
--Russ
> I got this error messages:
>
>
>
> /tmp/ifortPdz6YD.o: In function `MAIN__':
>
> simple_xy_wr.f:(.text+0x31e): undefined reference to `nf_create_'
>
> simple_xy_wr.f:(.text+0x354): undefined reference to `nf_def_dim_'
>
> simple_xy_wr.f:(.text+0x38a): undefined reference to `nf_def_dim_'
>
> simple_xy_wr.f:(.text+0x3ef): undefined reference to `nf_def_var_'
>
> simple_xy_wr.f:(.text+0x411): undefined reference to `nf_enddef_'
>
> simple_xy_wr.f:(.text+0x43c): undefined reference to `nf_put_var_int_'
>
> simple_xy_wr.f:(.text+0x45a): undefined reference to `nf_close_'
>
> simple_xy_wr.f:(.text+0x529): undefined reference to `nf_strerror_'
>
> simple_xy_wr.f:(.text+0x5f4): undefined reference to `nf_strerror_'
>
> simple_xy_wr.f:(.text+0x6bf): undefined reference to `nf_strerror_'
>
> simple_xy_wr.f:(.text+0x78a): undefined reference to `nf_strerror_'
>
> simple_xy_wr.f:(.text+0x855): undefined reference to `nf_strerror_'
>
> /tmp/ifortPdz6YD.o:simple_xy_wr.f:(.text+0x91d): more undefined references
> to `nf_strerror_' follow
>
>
>
> The outputs of the configure, make, testing and installation are offered in
> the attachment, which names "c.txt", "m.txt", "mc.txt" and "mi.txt"
> respectively.
>
>
>
> Could you tell me is there something wrong within it? Or have I done other
> mistakes?
>
>
>
> Thanks,
>
>
>
> Yinghui He
>
>
>
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: FNE-136603
Department: Support netCDF
Priority: Normal
Status: Closed