UA-RCL / RANC

https://ua-rcl.github.io/projects/ranc
MIT License
40 stars 12 forks source link

Cmake Error #14

Closed anujt21 closed 1 year ago

anujt21 commented 1 year ago

When I was trying to build the simulator I got the following error:

` In file included from /home/anuj/RANC/simulator/src/main.cpp:9: /home/anuj/RANC/simulator/extern/cxxopts.hpp: In member function ‘void cxxopts::values::detail::SignedCheck<T, true>::operator()(bool, U, const string&)’: /home/anuj/RANC/simulator/extern/cxxopts.hpp:488:43: error: ‘numeric_limits’ is not a member of ‘std’ 488 | if (u > static_cast(-(std::numeric_limits::min)())) | ^~~~~~ /home/anuj/RANC/simulator/extern/cxxopts.hpp:488:59: error: expected primary-expression before ‘>’ token 488 | if (u > static_cast(-(std::numeric_limits::min)())) | ^ /home/anuj/RANC/simulator/extern/cxxopts.hpp:488:62: error: ‘::min’ has not been declared; did you mean ‘std::min’? 488 | if (u > static_cast(-(std::numeric_limits::min)())) | ^~~ | std::min In file included from /usr/include/c++/11/algorithm:62, from /usr/include/c++/11/regex:38, from /home/anuj/RANC/simulator/extern/cxxopts.hpp:34, from /home/anuj/RANC/simulator/src/main.cpp:9: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: ‘std::min’ declared here 3455 | min(initializer_list<_Tp> l, _Compare comp) | ^~~ In file included from /home/anuj/RANC/simulator/src/main.cpp:9: /home/anuj/RANC/simulator/extern/cxxopts.hpp:495:42: error: ‘numeric_limits’ is not a member of ‘std’ 495 | if (u > static_cast((std::numeric_limits::max)())) | ^~~~~~ /home/anuj/RANC/simulator/extern/cxxopts.hpp:495:58: error: expected primary-expression before ‘>’ token 495 | if (u > static_cast((std::numeric_limits::max)())) | ^ /home/anuj/RANC/simulator/extern/cxxopts.hpp:495:61: error: ‘::max’ has not been declared; did you mean ‘std::max’? 495 | if (u > static_cast((std::numeric_limits::max)())) | ^~~ | std::max In file included from /usr/include/c++/11/algorithm:62, from /usr/include/c++/11/regex:38, from /home/anuj/RANC/simulator/extern/cxxopts.hpp:34, from /home/anuj/RANC/simulator/src/main.cpp:9: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here 3467 | max(initializer_list<_Tp> l, _Compare comp) | ^~~ In file included from /home/anuj/RANC/simulator/src/main.cpp:9: /home/anuj/RANC/simulator/extern/cxxopts.hpp: In function ‘void cxxopts::values::detail::check_signed_range(bool, U, const string&)’: /home/anuj/RANC/simulator/extern/cxxopts.hpp:515:29: error: ‘numeric_limits’ is not a member of ‘std’ 515 | SignedCheck<T, std::numeric_limits::is_signed>()(negative, value, text); | ^~~~~~ /home/anuj/RANC/simulator/extern/cxxopts.hpp:515:29: error: ‘numeric_limits’ is not a member of ‘std’ /home/anuj/RANC/simulator/extern/cxxopts.hpp:515:45: error: template argument 2 is invalid 515 | SignedCheck<T, std::numeric_limits::is_signed>()(negative, value, text); | ^ /home/anuj/RANC/simulator/extern/cxxopts.hpp:515:57: error: qualified-id in declaration before ‘>’ token 515 | SignedCheck<T, std::numeric_limits::is_signed>()(negative, value, text); | ^ /home/anuj/RANC/simulator/extern/cxxopts.hpp: In function ‘void cxxopts::values::integer_parser(const string&, T&)’: /home/anuj/RANC/simulator/extern/cxxopts.hpp:556:35: error: ‘numeric_limits’ is not a member of ‘std’ 556 | constexpr auto umax = (std::numeric_limits::max)(); | ^~~~~~ /home/anuj/RANC/simulator/extern/cxxopts.hpp:556:52: error: expected primary-expression before ‘>’ token 556 | constexpr auto umax = (std::numeric_limits::max)(); | ^ /home/anuj/RANC/simulator/extern/cxxopts.hpp:556:55: error: ‘::max’ has not been declared; did you mean ‘std::max’? 556 | constexpr auto umax = (std::numeric_limits::max)(); | ^~~ | std::max In file included from /usr/include/c++/11/algorithm:62, from /usr/include/c++/11/regex:38, from /home/anuj/RANC/simulator/extern/cxxopts.hpp:34, from /home/anuj/RANC/simulator/src/main.cpp:9: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /home/anuj/RANC/simulator/src/main.cpp:9: /home/anuj/RANC/simulator/extern/cxxopts.hpp:557:39: error: ‘numeric_limits’ is not a member of ‘std’ 557 | constexpr bool is_signed = std::numeric_limits::is_signed; | ^~~~~~ /home/anuj/RANC/simulator/extern/cxxopts.hpp:557:55: error: expected primary-expression before ‘>’ token 557 | constexpr bool is_signed = std::numeric_limits::is_signed; | ^ /home/anuj/RANC/simulator/extern/cxxopts.hpp:557:58: error: ‘::is_signed’ has not been declared; did you mean ‘std::is_signed’? 557 | constexpr bool is_signed = std::numeric_limits::is_signed; | ^~~~~ | std::is_signed In file included from /usr/include/c++/11/bits/move.h:57, from /usr/include/c++/11/bits/exception_ptr.h:43, from /usr/include/c++/11/exception:153, from /usr/include/c++/11/ios:39, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from /home/anuj/RANC/simulator/src/main.cpp:6: /usr/include/c++/11/type_traits:795:12: note: ‘std::is_signed’ declared here 795 | struct is_signed | ^~~~~ make[2]: [CMakeFiles/ranc_sim.dir/build.make:118: CMakeFiles/ranc_sim.dir/src/main.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/ranc_sim.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 `

I fixed it by adding the limits header file to cxxopts.hpp.

mackncheesiest commented 1 year ago

The current repository works in g++-9 and g++-10. I'm able to reproduce the issue in g++-11. Maybe a version bump of cxxopts is all we need

mackncheesiest commented 1 year ago

After bumping cxxopts to 3.0.0, I'm not seeing the issue anymore with g++-9, g++-10, or g++-11

Thanks for the catch