Project

General

Profile

no member named error during compilation

Added by ep gupal 7 months ago

I get the following errors during CDO 2.4.0 compilation process


libtool: compile:  mpic++ -std=gnu++20 -DHAVE_CONFIG_H -I. -I../libcdi/src -I../src/mpim_grid -DYAC_FOR_CDO -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include/udunits2 -DCDI_SIZE_TYPE=size_t -g -O3 -march=znver2 -Wall -fopenmp -pthread -MT libcdo_la-cdo_output.lo -MD -MP -MF .deps/libcdo_la-cdo_output.Tpo -c cdo_output.cc  -fPIC -DPIC -o .libs/libcdo_la-cdo_output.o
cdo_options.cc:167:23: error: no member named 'clamp' in namespace 'std'
  searchRadius = std::clamp(searchRadius, 0.0, 180.0);
                 ~~~~~^
1 error generated.
make[2]: *** [Makefile:1807: libcdo_la-cdo_options.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
cdo_module.cc:96:9: error: no member named 'find_if' in namespace 'std'; did you mean 'std::ranges::find_if'?
      = std::find_if(begin(operators), end(operators), [&p_operatorName](const oper_t &o) { return o.name == p_operatorName; });
        ^~~~~~~~~~~~
        std::ranges::find_if
/usr/lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ranges_util.h:543:33: note: 'std::ranges::find_if' declared here
  inline constexpr __find_if_fn find_if{};
                                ^
1 error generated.

My environment is like following

CC=mpicc (compiled with clang 16.0.3)
CXX=mpic++ (compiled with clang++ 16.0.3)

And the following is the configuration

  --prefix=/usr \
   --with-netcdf=/usr \
   --with-udunits2=/usr \
   --with-hdf5=/usr \
   --with-szlib=/usr \
   --with-proj=/usr \
   --with-fftw3

Thanks.


Replies (4)

RE: no member named error during compilation - Added by Uwe Schulzweida 7 months ago

Thanks for the information! We will add the missing include file in the next CDO release 2.4.1.
Cheers,
Uwe

RE: no member named error during compilation - Added by ep gupal 7 months ago

Isn't there a fix for this? I would like to use the application before the new version comes out...

RE: no member named error during compilation - Added by ep gupal 7 months ago

I think I found a solution. The compiler that I am using needed to be specified with a C++ version. So, for CXXFLAGS, I added -std=c++20, and it seems to be working for now. I have not tried any other C++ standard flags.

RE: no member named error during compilation - Added by ep gupal 7 months ago

Actually, adding -stdlib=libc++ fixed the problem. I think the problem arises from clang compiler not supporting some of the functions such as std::clamp and std:find_if by default.

    (1-4/4)