Record Detail

Compile Error

In file included from /in/Compile/check.cpp:7:
/in/sokoban.hpp:52:42: error: implicit conversion loses integer precision: 'const unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]
            hash ^= std::hash<int>{}(box.first) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
                    ~~~              ~~~~^~~~~
/in/sokoban.hpp:53:42: error: implicit conversion loses integer precision: 'const unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]
            hash ^= std::hash<int>{}(box.second) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
                    ~~~              ~~~~^~~~~~
/in/sokoban.hpp:69:32: error: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
    return is_valid_move(grid, new_box_x, new_box_y) && grid[new_box_x][new_box_y] != '#';
           ~~~~~~~~~~~~~       ^~~~~~~~~
/in/sokoban.hpp:69:43: error: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
    return is_valid_move(grid, new_box_x, new_box_y) && grid[new_box_x][new_box_y] != '#';
           ~~~~~~~~~~~~~                  ^~~~~~~~~
/in/sokoban.hpp:69:62: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
    return is_valid_move(grid, new_box_x, new_box_y) && grid[new_box_x][new_box_y] != '#';
                                                        ~~~~ ^~~~~~~~~
/in/sokoban.hpp:69:73: error: implicit conversion changes signedness: 'int' to 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
    return is_valid_move(grid, new_box_x, new_box_y) && grid[new_box_x][new_box_y] != '#';
                                                        ~~~~            ^~~~~~~~~
/in/sokoban.hpp:93:28: error: non-constant-expression cannot be narrowed from type 'int' to 'size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]
    State initial_state = {start_x, start_y, boxes};
                           ^~~~~~~
/in/sokoban.hpp:93:28: note: insert an explicit cast to silence this issue
    State initial_state = {start_x, start_y, boxes};
                           ^~~~~~~
                           static_cast<size_t>( )
/in/sokoban.hpp:93:37: error: non-constant-expression cannot be narrowed from type 'int' to 'size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]
    State initial_state = {start_x, start_y, boxes};
                                    ^~~~~~~
/in/sokoban.hpp:93:37: note: insert an explicit cast to silence this issue
    State initial_state = {start_x, start_y, boxes};
                                    ^~~~~~~
                                    static_cast<size_t>( )
/in/sokoban.hpp:93:46: error: no viable conversion from 'vector<pair<int, int>>' to 'vector<pair<size_t, size_t>>'
    State initial_state = {start_x, start_y, boxes};
                                             ^~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:326:7: note: candidate constructor not viable: no known conversion from 'std::vector<std::pair<int, int> >' to 'const std::vector<std::pair<unsigned long, unsigned long>, std::allocator<std::pair<unsigned long, unsigned long> > > &' for 1st argument
      vector(const vector& __x)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:344:7: note: candidate constructor not viable: no known conversion from 'std::vector<std::pair<int, int> >' to 'std::vector<std::pair<unsigned long, unsigned long>, std::allocator<std::pair<unsigned long, unsigned long> > > &&' for 1st argument
      vector(vector&& __x) noexcept
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:383:7: note: candidate constructor not viable: no known conversion from 'std::vector<std::pair<int, int> >' to 'initializer_list<std::vector<std::pair<unsigned long, unsigned long>, std::allocator<std::pair<unsigned long, unsigned long> > >::value_type>' (aka 'initializer_list<std::pair<unsigned long, unsigned long> >') for 1st argument
      vector(initializer_list<value_type> __l,
      ^
In file included from /in/Compile/check.cpp:7:
/in/sokoban.hpp:115:83: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            size_t new_player_x = current_state.player_x + direction_vectors[dir].first;
                                                         ~ ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/in/sokoban.hpp:115:78: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            size_t new_player_x = current_state.player_x + direction_vectors[dir].first;
                                                           ~~~~~~~~~~~~~~~~~ ^~~
/in/sokoban.hpp:116:83: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            size_t new_player_y = current_state.player_y + direction_vectors[dir].second;
                                                         ~ ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/in/sokoban.hpp:116:78: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            size_t new_player_y = current_state.player_y + direction_vectors[dir].second;
                                                           ~~~~~~~~~~~~~~~~~ ^~~
/in/sokoban.hpp:121:46: error: no viable conversion from 'vector<pair<size_t, size_t>>' to 'vector<pair<int, int>>'
            std::vector<std::pair<int, int>> new_boxes = current_state.box_positions;
                                             ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:326:7: note: candidate constructor not viable: no known conversion from 'std::vector<std::pair<size_t, size_t> >' (aka 'vector<pair<unsigned long, unsigned long> >') to 'const std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > &' for 1st argument
      vector(const vector& __x)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:344:7: note: candidate constructor not viable: no known conversion from 'std::vector<std::pair<size_t, size_t> >' (aka 'vector<pair<unsigned long, unsigned long> >') to 'std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > &&' for 1st argument
      vector(vector&& __x) noexcept
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:383:7: note: candidate constructor not viable: no known conversion from 'std::vector<std::pair<size_t, size_t> >' (aka 'vector<pair<unsigned long, unsigned long> >') to 'initializer_list<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >::value_type>' (aka 'initializer_list<std::pair<int, int> >') for 1st argument
      vector(initializer_list<value_type> __l,
      ^
In file included from /in/Compile/check.cpp:7:
/in/sokoban.hpp:139:58: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                    q.push({new_state, path + directions[dir]});
                                              ~~~~~~~~~~ ^~~
/in/sokoban.hpp:81:27: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
                start_x = i;
                        ~ ^
/in/sokoban.hpp:82:27: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
                start_y = j;
                        ~ ^
17 errors generated.
/in/Compile/Makefile:16: recipe for target 'main' failed
make: *** [main] Error 1

Information

Submit By
Type
Submission
Homework
Project3
Language
C++
Submit At
2024-11-26 23:11:55
Judged At
2024-11-26 23:11:55
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes