Hi Russ,
thanks a lot. I did as you suggested. I buid ncdump/nccopy.c after installing
netCDF 4.1.1 but I have the following error. Probably something is missing?
Thank you for the attention
Emanuele Cordano
**** Build of configuration Debug for project z_test_netcdf_copy ****
make all
Building file: ../main.c
Invoking: GCC C Compiler
gcc -I/Users/ecor/libraries_x_netcdf4/netcdf-4.1.1/include
-I/Users/ecor/libraries_x_netcdf4/netcdf-4.1.1_src/ncdump
-I/Users/ecor/libraries_x_netcdf4/netcdf-4.1.1_src
-I/Users/ecor/libraries_x_netcdf4/hdf5-1.8.3/include
-I/Users/ecor/libraries_x_netcdf4/zlib-1.2.3/include -O0 -g3 -Wall -c
-fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.c"
Finished building: ../main.c
Building file: ../nccopy.c
Invoking: GCC C Compiler
gcc -I/Users/ecor/libraries_x_netcdf4/netcdf-4.1.1/include
-I/Users/ecor/libraries_x_netcdf4/netcdf-4.1.1_src/ncdump
-I/Users/ecor/libraries_x_netcdf4/netcdf-4.1.1_src
-I/Users/ecor/libraries_x_netcdf4/hdf5-1.8.3/include
-I/Users/ecor/libraries_x_netcdf4/zlib-1.2.3/include -O0 -g3 -Wall -c
-fmessage-length=0 -MMD -MP -MF"nccopy.d" -MT"nccopy.d" -o"nccopy.o"
"../nccopy.c"
../nccopy.c: In function 'free_var_chunk_cache':
../nccopy.c:466: warning: unused variable 'outkind'
Finished building: ../nccopy.c
Building target: z_test_netcdf_copy
Invoking: MacOS X C Linker
gcc -L/Users/ecor/libraries_x_netcdf4/netcdf-4.1.1/lib
-L/Users/ecor/libraries_x_netcdf4/hdf5-1.8.3/lib
-L/Users/ecor/libraries_x_netcdf4/zlib-1.2.3/lib -o "z_test_netcdf_copy"
./main.o ./nccopy.o -lnetcdf -lhdf5_hl -lhdf5 -lz
Undefined symbols:
"_curl_easy_getinfo", referenced from:
_ocfetchhttpcode in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchurl_file in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
"_nc_next_iter", referenced from:
_copy_var_data in nccopy.o
"_curl_easy_perform", referenced from:
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchurl_file in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
"_nc_get_iter", referenced from:
_copy_var_data in nccopy.o
"_curl_version_info", referenced from:
_ocopen in libnetcdf.a(liboc_la-ocinternal.o)
"_curl_easy_setopt", referenced from:
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchurl_file in libnetcdf.a(liboc_la-http.o)
_ocfetchurl_file in libnetcdf.a(liboc_la-http.o)
_ocfetchurl_file in libnetcdf.a(liboc_la-http.o)
_ocfetchurl_file in libnetcdf.a(liboc_la-http.o)
_occurlopen in libnetcdf.a(liboc_la-http.o)
_occurlopen in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
_set_verify in libnetcdf.a(liboc_la-curlfunctions.o)
_set_verify in libnetcdf.a(liboc_la-curlfunctions.o)
_set_cookies in libnetcdf.a(liboc_la-curlfunctions.o)
_set_cookies in libnetcdf.a(liboc_la-curlfunctions.o)
_set_user_password in libnetcdf.a(liboc_la-curlfunctions.o)
_set_user_password in libnetcdf.a(liboc_la-curlfunctions.o)
_set_proxy in libnetcdf.a(liboc_la-curlfunctions.o)
_set_proxy in libnetcdf.a(liboc_la-curlfunctions.o)
_set_proxy in libnetcdf.a(liboc_la-curlfunctions.o)
"_curl_easy_init", referenced from:
_occurlopen in libnetcdf.a(liboc_la-http.o)
"_curl_easy_strerror", referenced from:
_ocsetcurlproperties in libnetcdf.a(liboc_la-http.o)
_ocfetchlastmodified in libnetcdf.a(liboc_la-http.o)
_ocfetchurl_file in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
_ocfetchurl in libnetcdf.a(liboc_la-http.o)
"_curl_easy_cleanup", referenced from:
_occurlclose in libnetcdf.a(liboc_la-http.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [z_test_netcdf_copy] Error 1
On Aug 30, 2010, at 4:37 PM, Russ Rew wrote:
> Hi Emanuele,
>
>> I'm working in C with netCDF 4 and I'm searching a way of copying the
>> dimensions and the global attributes from a netCDF file to another one.
>> I was looking at the example program:
>>
>> http://www.unidata.ucar.edu/software/netcdf/examples/programs/nccopy4.c
>>
>> then I compiled the program and I linked the netcdf, hdf5_hl, hdf and z
>> libraries as I have usually done, but I received the following linkage
>> error related to the function nc_inq_typeid whose definition and content
>> are not found.
>
> Oops, the function nc_inq_typeid() used by that example was not added
> until after version 4.0.1 was released. If you try building with the
> current release (4.1.1) or any subsequent release, that function is
> included.
>
> If you're going to use 4.1.1 or later, you could also just use the
> ncdump/nccopy.c source for the nccopy utility included with that
> release.
>
> --Russ