C++ compilation

This commit is contained in:
Shahram Najm 2023-01-06 19:14:02 +00:00
parent fdb896edab
commit 0d7088b096
3 changed files with 13 additions and 11 deletions

View File

@ -77,6 +77,12 @@ foreach( tool ${ecc_tools_binaries_extra} )
LIBS ecc_tools ) LIBS ecc_tools )
endforeach() endforeach()
if( HAVE_EXPERIMENTAL_BUILD_WITH_CXX )
set_source_files_properties(bufr_filter.c PROPERTIES LANGUAGE CXX)
set_source_files_properties(codes_count.c PROPERTIES LANGUAGE CXX)
set_source_files_properties(grib_to_netcdf.c PROPERTIES LANGUAGE CXX)
endif()
# grib_count/bufr_count etc. Same source code, different executable names # grib_count/bufr_count etc. Same source code, different executable names
ecbuild_add_executable( TARGET grib_count ecbuild_add_executable( TARGET grib_count
SOURCES codes_count.c SOURCES codes_count.c
@ -100,9 +106,6 @@ ecbuild_add_executable( TARGET grib_list_keys
CONDITION ECCODES_INSTALL_EXTRA_TOOLS CONDITION ECCODES_INSTALL_EXTRA_TOOLS
LIBS ecc_tools ) LIBS ecc_tools )
if( HAVE_EXPERIMENTAL_BUILD_WITH_CXX )
set_source_files_properties(bufr_filter.c PROPERTIES LANGUAGE CXX)
endif()
ecbuild_add_executable( TARGET codes_bufr_filter ecbuild_add_executable( TARGET codes_bufr_filter
SOURCES bufr_filter.c SOURCES bufr_filter.c
LIBS ecc_tools ) LIBS ecc_tools )

View File

@ -8,8 +8,7 @@
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/ */
#include "grib_api.h" #include "grib_api_internal.h"
#include <assert.h>
#define CMAP_MAX 20480 #define CMAP_MAX 20480
@ -186,7 +185,7 @@ int main(int argc, char* argv[])
for (jj = 0; jj < height; jj++) { for (jj = 0; jj < height; jj++) {
for (i = 0; i < width; i++) { for (i = 0; i < width; i++) {
int m = (i + width / 2) % width + jj * width; int m = (i + width / 2) % width + jj * width;
assert(k < count); Assert(k < count);
indices[k++] = m; indices[k++] = m;
} }
} }

View File

@ -2945,10 +2945,10 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase
for (i = 0; i < naxis; ++i) { for (i = 0; i < naxis; ++i) {
int nctype = NC_INT; int nctype = NC_INT;
const char* axis = get_axis(h, i); const char* axis = get_axis(h, i);
char* units = NULL; const char* units = NULL;
char u[10240]; char u[10240];
const char* lowaxis = (axis); const char* lowaxis = (axis);
char* longname = (char*)lowaxis; const char* longname = (char*)lowaxis;
n = count_values(cube, axis); n = count_values(cube, axis);
if (count_values(data_r, "levtype") > 1) { if (count_values(data_r, "levtype") > 1) {
@ -3049,7 +3049,7 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase
const char* cal = "gregorian"; const char* cal = "gregorian";
if (setup.mmeans) { if (setup.mmeans) {
char* period = "0000-01-00 00:00:00"; const char* period = "0000-01-00 00:00:00";
stat = nc_put_att_text(ncid, var_id, "avg_period", strlen(period), period); stat = nc_put_att_text(ncid, var_id, "avg_period", strlen(period), period);
check_err("nc_put_att_text", stat, __LINE__); check_err("nc_put_att_text", stat, __LINE__);
} }
@ -3179,7 +3179,7 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase
char timestamp[80]; char timestamp[80];
time_t now; time_t now;
/* char *convention = "MARS;CF"; */ /* char *convention = "MARS;CF"; */
char* convention = "CF-1.6"; const char* convention = "CF-1.6";
char history[10240]; char history[10240];
/* char *institution = "ECMWF Meteorological Archival and Retrieval System"; */ /* char *institution = "ECMWF Meteorological Archival and Retrieval System"; */
@ -3936,7 +3936,7 @@ static int deflate_option = 0;
/* Table of formats for legal -k values. Inspired by nccopy */ /* Table of formats for legal -k values. Inspired by nccopy */
struct KindValue struct KindValue
{ {
char* name; const char* name;
int kind; int kind;
} legalkinds[] = { } legalkinds[] = {
{ "1", NC_FORMAT_CLASSIC }, { "1", NC_FORMAT_CLASSIC },