raspberrypi / picotool

BSD 3-Clause "New" or "Revised" License
555 stars 95 forks source link

Build error "‘numeric_limits’ is not a member of ‘std’" #31

Closed thierer closed 3 years ago

thierer commented 3 years ago

I ran into the following error when trying to build picotool on Linux:

.../picotool/cli.h: In member function ‘D& cli::matchable_derived<T>::repeatable()’:
.../picotool/cli.h:257:25: error: ‘numeric_limits’ is not a member of ‘std’
  257 |             _max = std::numeric_limits<int>::max();

(And a few follow-up errors).

Google lead me to the solution of adding #include <limits>to cli.h.

This is on Arch Linux using gcc 11.1.0, libstdc++ 3.3.6 and cmake 3.20.2 (I don't know enough about C++ to make a qualified guess what the root issue is, but I'm surprised nobody seems to have reported this yet, so it might well depend on the build environment).

thierer commented 3 years ago

Update: Seems to be caused by gcc 11

https://www.gnu.org/software/gcc/gcc-11/porting_to.html#header-dep-changes

thierer commented 3 years ago

Second (and last) update :) Found #30, so closing this...