Compiling Cling error: ‘numeric_limits’ is not a member of ‘std’

[100%] Building CXX object utils/benchmark/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o
cd /mnt/C460FA9960FA9202/cling-src/obj/utils/benchmark/src && /usr/bin/c++ -DHAVE_POSIX_REGEX -DHAVE_STD_REGEX -DHAVE_STEADY_CLOCK -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/mnt/C460FA9960FA9202/cling-src/obj/utils/benchmark/src -I/mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src -I/usr/include/libxml2 -I/mnt/C460FA9960FA9202/cling-src/obj/include -I/mnt/C460FA9960FA9202/cling-src/src/include -I/mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/include -I/mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections  -std=c++11  -Wall  -Wextra  -Wshadow  -pedantic  -pedantic-errors  -Wfloat-equal  -fstrict-aliasing  -fno-exceptions  -Wstrict-aliasing -O3 -DNDEBUG -o CMakeFiles/benchmark.dir/benchmark_register.cc.o -c /mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.cc
In file included from /mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.cc:15:
/mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.h: In function ‘void AddRange(std::vector<T>*, T, T, int)’:
/mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.h:17:30: error: ‘numeric_limits’ is not a member of ‘std’
   17 |   static const T kmax = std::numeric_limits<T>::max();
      |                              ^~~~~~~~~~~~~~
/mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.h:17:46: error: expected primary-expression before ‘>’ token
   17 |   static const T kmax = std::numeric_limits<T>::max();
      |                                              ^
/mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.h:17:49: error: ‘::max’ has not been declared; did you mean ‘std::max’?
   17 |   static const T kmax = std::numeric_limits<T>::max();
      |                                                 ^~~
      |                                                 std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/include/benchmark/benchmark.h:175,
                 from /mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/internal_macros.h:4,
                 from /mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/check.h:8,
                 from /mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.h:6,
                 from /mnt/C460FA9960FA9202/cling-src/src/utils/benchmark/src/benchmark_register.cc:15:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
make[2]: *** [utils/benchmark/src/CMakeFiles/benchmark.dir/build.make:95: utils/benchmark/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o] Error 1
make[2]: Leaving directory '/mnt/C460FA9960FA9202/cling-src/obj'
make[1]: *** [CMakeFiles/Makefile2:142478: utils/benchmark/src/CMakeFiles/benchmark.dir/all] Error 2
make[1]: Leaving directory '/mnt/C460FA9960FA9202/cling-src/obj'
make: *** [Makefile:171: all] Error 2

Ubuntu 21.10 - gcc 11.2.0


first I used the clone.sh described in root website but after getting a build error I used command: cd obj; make VERBOSE=1 -j1

That’s this: ⚙ D89450 llvm/utils/benchmark: add missing <limits> inclusion

You can just add #include <limits> for now; the next llvm upgrade should fix this.

Thanks! that solved my problem

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.