Record Detail

Compile Error

In file included from /in/Compile/check.cpp:7:
/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:104:26: error: implicit conversion changes signedness: 'const int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            if (grid[box.first][box.second] != 'T') {
                ~~~~ ~~~~^~~~~
/in/sokoban.hpp:104:37: error: implicit conversion changes signedness: 'const int' to 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            if (grid[box.first][box.second] != 'T') {
                ~~~~            ~~~~^~~~~~
/in/sokoban.hpp:115:58: error: implicit conversion changes signedness: 'int' to 'size_t' (aka '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:58: error: implicit conversion changes signedness: 'int' to 'size_t' (aka '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:127:85: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                    if (can_push_box(grid, box.first, box.second, direction_vectors[dir].first, direction_vectors[dir].second)) {
                                                                  ~~~~~~~~~~~~~~~~~ ^~~
/in/sokoban.hpp:127:115: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                    if (can_push_box(grid, box.first, box.second, direction_vectors[dir].first, direction_vectors[dir].second)) {
                                                                                                ~~~~~~~~~~~~~~~~~ ^~~
/in/sokoban.hpp:128:56: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                        box.first += direction_vectors[dir].first;
                                     ~~~~~~~~~~~~~~~~~ ^~~
/in/sokoban.hpp:129:57: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                        box.second += direction_vectors[dir].second;
                                      ~~~~~~~~~~~~~~~~~ ^~~
/in/sokoban.hpp:136:36: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
                State new_state = {new_player_x, new_player_y, new_boxes};
                                   ^~~~~~~~~~~~
/in/sokoban.hpp:136:36: note: insert an explicit cast to silence this issue
                State new_state = {new_player_x, new_player_y, new_boxes};
                                   ^~~~~~~~~~~~
                                   static_cast<int>( )
/in/sokoban.hpp:136:50: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
                State new_state = {new_player_x, new_player_y, new_boxes};
                                                 ^~~~~~~~~~~~
/in/sokoban.hpp:136:50: note: insert an explicit cast to silence this issue
                State new_state = {new_player_x, new_player_y, new_boxes};
                                                 ^~~~~~~~~~~~
                                                 static_cast<int>( )
/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:72:17: error: implicit conversion loses integer precision: 'std::vector::size_type' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
int rows = grid.size();
    ~~~~   ~~~~~^~~~~~
/in/sokoban.hpp:73:24: error: implicit conversion loses integer precision: 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    int cols = grid[0].size();
        ~~~~   ~~~~~~~~^~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 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:01:02
Judged At
2024-11-26 23:01:02
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes