Its probably because you link in the wrong order, it should be:
-lnetcdff -lnetcdf
2014-01-29 Letitia Soulliard - NOAA Affiliate <letitia.soulliard@xxxxxxxx>
> I'm trying to compile my code on a linux machine with pgcc/pgf90 using
> netCDF netcdf-4.2.1.1/ and
> netcdf-fortran-4.2/. My code is FORTRAN 90.
>
> I am getting the following errors... and I'm totally stumped as to what is
> causing the problem.
>
> I've compiled this successfully on another machine, but that machine died.
> So I've had to re-install hdf5 and netcdf4 as well as my code.
>
> pgf90 -m64 -Bstatic -g77libs -byteswapio main_nucaps_ccr_to_netcdf.o
> -I/disk1/pub/letitias/util/netcdf-4/include
> -I/disk1/pub/letitias/util/hdf5/include -I../allocate
> -I../netcdf_readwrite_f90 -I../include -I../subset -I../modules
> -I../netcdf_utils_f90 -I../subset_level1c_products -I../pc -I../dem
> -I../global_grids -I../matchups -I../level2 -I../time -I../grib -I../wesley
> -I../monitoring -I../futils -I../hdf5_f90 -L../allocate -lallocate
> -L/disk1/pub/letitias/util/netcdf-4/lib -lnetcdf -lnetcdff
> -L../netcdf_readwrite_f90 -lnetcdf_readwrite_f90 -L../include -linclude
> -L../subset -lsubset -L../modules -lmodules -L../netcdf_utils_f90
> -lnetcdf_utils_f90 -L../subset_level1c_products -lsub_prod -L../pc -lpc
> -L../dem -ldem -L../global_grids -lglobal_grids -L../matchups -lmatchups
> -L../level2 -llevel2 -L../monitoring -lmonitoring -L../time -lwwwtime
> -L../grib -lgrib -L../wesley -lwesley -L../futils -lfutils -L../hdf5_f90
> -lhdf5_f90 -L/disk1/pub/letitias/util/netcdf-4/lib -lnetcdf -lnetcdff
> -L/disk1/pub/letitias/util/hdf5/lib -lhdf5hl_fortran -lhdf5_hl
> -lhdf5_fortran -lhdf5 -lz -lm -o main_nucaps_ccr_to_netcdf
> /disk1/pub/letitias/util/netcdf-4/lib/libnetcdff.a(fort-attio.o): In
> function `nf_put_att_text_':
> /disk1/pub/letitias/util/netcdf-4/netcdf-fortran-4.2/fortran/./fort-attio.c:15:
> undefined reference to `nc_put_att_text'
> /disk1/pub/letitias/util/netcdf-4/lib/libnetcdff.a(fort-attio.o): In
> function `nf_get_att_text_':
> /disk1/pub/letitias/util/netcdf-4/netcdf-fortran-4.2/fortran/./fort-attio.c:22:
> undefined reference to `nc_get_att_text'
> /disk1/pub/letitias/util/netcdf-4/lib/libnetcdff.a(fort-attio.o): In
> function `nf_put_att_int1_':
> /disk1/pub/letitias/util/netcdf-4/netcdf-fortran-4.2/fortran/./fort-attio.c:30:
> undefined reference to `nc_put_att_schar'
>
> The errors continue like that for quite a while. The end of the error
> message looks like...
>
> /disk1/pub/letitias/util/netcdf-4/netcdf-fortran-4.2/fortran/./fort-nc4.c:232:
> undefined reference to `nc_set_var_chunk_cache_ints'
> /disk1/pub/letitias/util/netcdf-4/lib/libnetcdff.a(fort-nc4.o): In
> function `nf_get_var_chunk_cache_':
> /disk1/pub/letitias/util/netcdf-4/netcdf-fortran-4.2/fortran/./fort-nc4.c:234:
> undefined reference to `nc_get_var_chunk_cache_ints'
> make: *** [main_nucaps_ccr_to_netcdf] Error 2
>
> Thanks,
> Tish Soulliard
>
> NOAA/NESDIS/STAR
>
> letitia.soulliard@xxxxxxxx
> 301-683-3538
>
> National Oceanic and Atmospheric Administration
> NESDIS/STAR/SMCD/OPDB
> Letitia Soulliard
> NCWCP (E/RA23)
> 5830 University Research Court
> Floor 2, Room 2686
> College Park, MD 20740-3818
>
>
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
--
Kind regards Nick