Skip to content

Error at compilation: ‘begin’ was not declared in this scope for the Bandit Policies #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Lip651 opened this issue Mar 16, 2025 · 2 comments

Comments

@Lip651
Copy link

Lip651 commented Mar 16, 2025

Hello,

I am having a compilation error at the make step during the installation. These are my settings:

g++ --version
g++ (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0

The error is occuring at line 22 in the file "AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp".
Would you have any recommendation with respect to how I should modify the code ? I fear my compiler is too old. The full error message is:

/home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp: In constructor ‘AIToolbox::Factored::Bandit::MARMaxPolicy::MARMaxPolicy(const AIToolbox::Factored::Bandit::Experience&, AIToolbox::Vector, double, double, bool)’:
/home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:22:27: error: ‘begin’ was not declared in this scope
   22 |             for (auto r : ranges_) {
      |                           ^~~~~~~
/home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:22:27: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:69,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Bandit/Policies/MARMaxPolicy.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:1:
/usr/include/c++/10/bits/range_access.h:108:37: note:   ‘std::begin’
  108 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
In file included from /usr/include/c++/10/bits/stl_iterator_base_types.h:71,
                 from /usr/include/c++/10/bits/stl_algobase.h:65,
                 from /usr/include/c++/10/vector:60,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Bandit/Policies/MARMaxPolicy.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:1:
/usr/include/c++/10/bits/iterator_concepts.h:921:10: note:   ‘std::__detail::begin’
  921 |     void begin(const auto&) = delete;
      |          ^~~~~
In file included from /usr/include/c++/10/vector:69,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Bandit/Policies/MARMaxPolicy.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:1:
/usr/include/c++/10/bits/range_access.h:855:44: note:   ‘std::ranges::__cust::begin’
  855 |     inline constexpr __cust_access::_Begin begin{};
      |                                            ^~~~~
/home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:22:27: error: ‘end’ was not declared in this scope
   22 |             for (auto r : ranges_) {
      |                           ^~~~~~~
/home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:22:27: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:69,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Types.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/include/AIToolbox/Factored/Bandit/Policies/MARMaxPolicy.hpp:4,
                 from /home/master/Desktop/AI-Toolbox/src/Factored/Bandit/Policies/MARMaxPolicy.cpp:1:
/usr/include/c++/10/bits/range_access.h:110:37: note:   ‘std::end’
  110 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
/usr/include/c++/10/bits/range_access.h:856:42: note:   ‘std::ranges::__cust::end’
  856 |     inline constexpr __cust_access::_End end{};
      |                                          ^~~
/usr/include/c++/10/bits/range_access.h:434:10: note:   ‘std::ranges::__cust_access::end’
  434 |     void end(const auto&) = delete;
      |          ^~~
make[2]: *** [src/CMakeFiles/AIToolboxFMDP.dir/build.make:370: src/CMakeFiles/AIToolboxFMDP.dir/Factored/Bandit/Policies/MARMaxPolicy.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1114: src/CMakeFiles/AIToolboxFMDP.dir/all] Error 2
make: *** [Makefile:101: all] Error 2

Any recommendation would be much appreciated. Best regards, Joachim

@Svalorzen
Copy link
Owner

Could you share the full output of your first call to cmake (delete the build folder, re-run cmake, and post here the output)?
Thanks!

@Lip651
Copy link
Author

Lip651 commented Mar 18, 2025

Sure, this is what I have:

cmake .. 
-- The CXX compiler identification is GNU 10.5.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:137 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.67")
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "3.2.92")
-- Performing Test LPSOLVE_LINKS_ALONE
-- Performing Test LPSOLVE_LINKS_ALONE - Success
-- Found LpSolve: /usr/lib/lp_solve/liblpsolve55.so
CMake Warning (dev) at CMakeLists.txt:188 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.67") found components: unit_test_framework

### AI_TOOLBOX SETTINGS ###
- No project build options provided, defaulting to MAKE_ALL..
-- CMAKE_BUILD_TYPE:   Release
-- IPO / LTO enabled
✓ Building everything      (-DMAKE_ALL=1)
✓ Building entire library  (-DMAKE_LIB=1)
✓ Building MDP             (-DMAKE_MDP=1)
✓ Building Factored MDP    (-DMAKE_FMDP=1)
✓ Building POMDP           (-DMAKE_POMDP=1)
✓ Building Tests           (-DMAKE_TESTS=1)
✓ Building Examples        (-DMAKE_EXAMPLES=1)
✗ NOT Building Python bindings (-DMAKE_PYTHON=0)
✗ NOT Enabled runtime logging  (-DAI_LOGGING_ENABLED=0)

-- Configuring done (0.8s)
-- Generating done (0.2s)
-- Build files have been written to: /home/master/Desktop/AI-Toolbox/build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants