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.
Lou, > > By default, versions 4.1.3 and later install shared libraries. When shared > > libraries are used, netCDF needs to create a separate library for Fortran > > instead of combining the C and Fortran libraries together into one static > > library. Therefor, you need to tell gfortran where to look for the Fortran > > functions, which will be in a library with the name "libnetcdff". > > > > So first try linking with the shared libraries, using > > > > gfortran test_prog.f90 -I/usr/local/include -L/usr/local/lib -lnetcdff > > -lnetcdf > > > > You can also link with the static libraries by instead using > > > > gfortran test_prog.f90 -I/usr/local/include /usr/local/lib/libnetcdff.a > > /usr/local/lib/libnetcdf.a > > In both cases, I got many messages (identical I believe) of the sort: > > /usr/local/lib/libnetcdf.a(liboc_la-ocinternal.o): In function > `ocinternalinitialize': > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/ocinternal.c:142: > undefined reference to `_curl_version_info' > /usr/local/lib/libnetcdf.a(liboc_la-http.o): In function `ocfetchhttpcode': > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:27: undefined > reference to `_curl_easy_getinfo' > /usr/local/lib/libnetcdf.a(liboc_la-http.o): In function `ocfetchurl_file': > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:41: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:46: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:79: undefined > reference to `_curl_easy_strerror' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:51: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:56: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:60: undefined > reference to `_curl_easy_perform' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:74: undefined > reference to `_curl_easy_getinfo' > /usr/local/lib/libnetcdf.a(liboc_la-http.o): In function `ocfetchurl': > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:91: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:96: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:133: undefined > reference to `_curl_easy_strerror' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:101: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:106: undefined > reference to `_curl_easy_setopt' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:108: undefined > reference to `_curl_easy_perform' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:119: undefined > reference to `_curl_easy_getinfo' > /home/goodlou/Netcdf-download/netcdf-4.1.3/oc/http.c:111: undefined > reference to `_curl_easy_strerror' All these are from the "curl" library, that's required for OPeNDAP support, which is included by default if you don't specify the --disable-dap option to configure when you build netCDF, and if the configure script locates a working libcurl. For shared libraries, the location of libcurl should have been built in to the library, but for static libraries it would need to be specified, as in gfortran test_prog.f90 -I/usr/local/include -L/usr/local/lib -lnetcdff -lnetcdf -lcurl if it was in /usr/local/lib, otherwise you'd need to say where it was with -L/where/libcurl/is. Does the output of nc-config --all include the line ? --has-dap -> yes If so, what are the outputs of nc-config --flibs and nc-config --libs ? --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: QYJ-726116 Department: Support netCDF Priority: Normal Status: Closed