From 2ad11d3c14da782aa8a62ee6ca96f20422c01284 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 17 Jan 2024 17:03:27 -0800 Subject: [PATCH 1/2] Correct an issue with the compiler. --- cxx4/ncGroup.cpp | 4 ++-- cxx4/test_dim.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cxx4/ncGroup.cpp b/cxx4/ncGroup.cpp index 5be5bde..e20f162 100644 --- a/cxx4/ncGroup.cpp +++ b/cxx4/ncGroup.cpp @@ -1347,8 +1347,8 @@ map NcGroup::getCoordVars(NcGroup::Location location) const { // Get the NcDim and NcVar object pair for a named coordinate variables. void NcGroup::getCoordVar(const string& coordVarName, NcDim& ncDim, NcVar& ncVar, NcGroup::Location location) const { // Nullify existing dim/var in case no coordinate variable found - ncDim = NcDim{}; - ncVar = NcVar{}; + ncDim = NcDim(); + ncVar = NcVar(); // search in current group and parent groups. multimap::iterator itD; diff --git a/cxx4/test_dim.cpp b/cxx4/test_dim.cpp index e0b1130..36b856b 100644 --- a/cxx4/test_dim.cpp +++ b/cxx4/test_dim.cpp @@ -39,8 +39,8 @@ int main() cout < Date: Wed, 17 Jan 2024 17:14:46 -0800 Subject: [PATCH 2/2] Updating build system to enforce C++11 standard. --- CMakeLists.txt | 2 ++ configure.ac | 3 +++ cxx4/ncGroup.cpp | 4 ++-- cxx4/test_dim.cpp | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6202498..649659c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -432,6 +432,8 @@ ENDIF() # # Also, set some other default compiler flags. ## +SET(CMAKE_CXX_STANDARD 11) +SET(CMAKE_CXX_STANDARD_REQUIRED TRUE) IF(CMAKE_COMPILER_IS_GNUCC OR APPLE) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-variable -Wno-unused-parameter") diff --git a/configure.ac b/configure.ac index 31d49b5..e9f75b4 100644 --- a/configure.ac +++ b/configure.ac @@ -175,6 +175,9 @@ AC_FUNC_MALLOC # Check to see if any macros must be set to enable large (>2GB) files. AC_SYS_LARGEFILE +# Set the CXXFLAGSS +CXXFLAGS="$CXXFLAGS --std=c++11" + # User supplied nc-config AC_ARG_WITH([nc-config], [AS_HELP_STRING([--with-nc-config=DIR], diff --git a/cxx4/ncGroup.cpp b/cxx4/ncGroup.cpp index e20f162..5be5bde 100644 --- a/cxx4/ncGroup.cpp +++ b/cxx4/ncGroup.cpp @@ -1347,8 +1347,8 @@ map NcGroup::getCoordVars(NcGroup::Location location) const { // Get the NcDim and NcVar object pair for a named coordinate variables. void NcGroup::getCoordVar(const string& coordVarName, NcDim& ncDim, NcVar& ncVar, NcGroup::Location location) const { // Nullify existing dim/var in case no coordinate variable found - ncDim = NcDim(); - ncVar = NcVar(); + ncDim = NcDim{}; + ncVar = NcVar{}; // search in current group and parent groups. multimap::iterator itD; diff --git a/cxx4/test_dim.cpp b/cxx4/test_dim.cpp index 36b856b..e0b1130 100644 --- a/cxx4/test_dim.cpp +++ b/cxx4/test_dim.cpp @@ -39,8 +39,8 @@ int main() cout <