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.
>To: address@hidden >From: Mimi Lee <address@hidden> >Subject: ncopen >Organization: UCLA >Keywords: 200207180254.g6I2suH04290 Mimi, > First of all, I would like to thank you for such prompt response. I > was able to find the v2i.c file at /src/librc directory. but it's > subsequent files for lnetcdf which is esstial for ncopen is no where > to be found. below is the output msg. > > The end result in bin, lib, and include directory is > lib/ > libnetcdf.a libnetcdf_c++.a > > inlcude/ > ncvalues.h netcdfcpp.h netcdf.h netcdf.hh netcdf.inc NETCDF.mod > > bin/ > ncdump ncgen > > As you can see, only ncdump and ncgen are being generated and if you > can scroll down and see the error msg, "for ncopen in -lnetcdf" > doesn't not exist. I know I must be missing something here ... ncdump and ncgen are the only executables that should be in the bin/ directory, since they are the only programs that come with the netCDF distribution. They are utility programs, used to convert between binary netCDF data and a text representation of the data. "ncopen" is a library function that should be part of the libnetcdf.a archive in the lib/ directory. "-lnetcdf" is just a shortcut for specifying the library "libnetcdf.a" to a linker or compiler, assuming it has the directory containing that library archive in its list of which directories to search. So, for example, if libnetcdf.a was stored in the /usr/local/netcdf/lib/ directory, a compiler might be instructed to look there and use the netCDF library with the arguments -L/usr/local/netcdf/lib -lnetcdf or by including that directory in a LD_LIBRARY_PATH environment variable. It is possible that the libnetcdf.a you have was built to explicitly not include the netCDF version 2 interfaces (ncopen is a version 2 netCDF interface) if someone built it with the macro "NO_NETCDF_2" defined, for example using the compiler flag "-DNO_NETCDF_2". Otherwise, all the version 2 interfaces including ncopen are included in the library by default. You can check whether ncopen is in your libnetcdf.a archive by using the "nm" program, using something like: % cd lib # change to the lib/ directory containing libnetcdf.a % nm -A libnetcdf.a | grep ncopen and you should see output something like libnetcdf.a[v2i.o]: [23] | 356| 72|FUNC |GLOB |0 |2 |ncopen libnetcdf.a[fort-v2compat.o]: [84] | 0| 0|FUNC |GLOB |0 |UNDEF |ncopen the first line indicating "ncopen" is a global symbol defined in the v2i.o module in the library, and the second line indicating ncopen is referenced in the fort-v2compat.o module also in the library. The second line may not appear if your library was not built to support a Fortran interface. The format of these lines and specific numbers may differ depending on platform, but "ncopen" is there if any line similar to the first above appears in the output. If there is no "ncopen" line in the output of "nm", then someone built your library with "-DNO_NETCDF_2" included in the CFLAGS or CPPFLAGS environment variable before running the configure script. In that case, you will have to rebuild the netCDF library from source, omitting that macro definition from your CFLAGS or CPPFLAGS environment variables before building. Instructions for building from scratch are in the INSTALL.html file at http://www.unidata.ucar.edu/packages/netcdf/INSTALL.html --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu