Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
124 stars 49 forks source link

NetCDF-C++4 API v.4.3.1: unused variable warning #85

Open MetalKnight opened 4 years ago

MetalKnight commented 4 years ago

Hello, the latest C++4 APIs v.4.3.1 have the following compiler warning

netcdf4/include/ncGroup.h:18:14: error: ‘netCDF::file_id’ defined but not used [-Werror=unused-variable] static int file_id; ^

which is preventing compilation with warning treated as errors in programs that compile and link against NetCDF shared objects + include files.

MetalKnight commented 4 years ago

it seems that file_id was added in this commit https://github.com/Unidata/netcdf-cxx4/commit/ecc28186eb4a00bd79545011f0bee65aa41cf09b

but its usage was then removed later on.

furthermore having a static variable in a .h is forcing a definition of the variable in every translation unit that include the .h files, therefore not only the library, but also its clients.