Record Detail

Compile Error

In file included from /in/Compile/check.cpp:7:
/in/sokoban.hpp:32:26: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
        for(int j = 0; j < width; j++){
                       ~ ^ ~~~~~
/in/sokoban.hpp:126:25: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
    state startState = {startx, starty, boxes, ""};
                        ^~~~~~
/in/sokoban.hpp:126:25: note: insert an explicit cast to silence this issue
    state startState = {startx, starty, boxes, ""};
                        ^~~~~~
                        static_cast<int>( )
/in/sokoban.hpp:126:33: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
    state startState = {startx, starty, boxes, ""};
                                ^~~~~~
/in/sokoban.hpp:126:33: note: insert an explicit cast to silence this issue
    state startState = {startx, starty, boxes, ""};
                                ^~~~~~
                                static_cast<int>( )
/in/sokoban.hpp:152:59: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            int newPlayerx = current.playerx + directions[i].first;
                                               ~~~~~~~~~~ ^
/in/sokoban.hpp:153:59: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            int newPlayery = current.playery + directions[i].second;
                                               ~~~~~~~~~~ ^
/in/sokoban.hpp:156:22: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            if (grid[newPlayerx][newPlayery] == '#') continue;
                ~~~~ ^~~~~~~~~~
/in/sokoban.hpp:156:34: 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]
            if (grid[newPlayerx][newPlayery] == '#') continue;
                ~~~~             ^~~~~~~~~~
/in/sokoban.hpp:164:58: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                    int newBoxX = box.first + directions[i].first;
                                              ~~~~~~~~~~ ^
/in/sokoban.hpp:165:59: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                    int newBoxY = box.second + directions[i].second;
                                               ~~~~~~~~~~ ^
/in/sokoban.hpp:168:30: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                    if (grid[newBoxX][newBoxY] == '#' || 
                        ~~~~ ^~~~~~~
/in/sokoban.hpp:168:39: 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]
                    if (grid[newBoxX][newBoxY] == '#' || 
                        ~~~~          ^~~~~~~
/in/sokoban.hpp:188:76: 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]
            q.push({newPlayerx, newPlayery, newBoxes, current.path + moves[i]});
                                                                     ~~~~~ ^
/in/sokoban.hpp:126:25: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    state startState = {startx, starty, boxes, ""};
                       ~^~~~~~
/in/sokoban.hpp:126:33: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    state startState = {startx, starty, boxes, ""};
                       ~        ^~~~~~
/in/sokoban.hpp:129:32: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    visited.insert(encodeState(startx, starty, boxes));
                   ~~~~~~~~~~~ ^~~~~~
/in/sokoban.hpp:129:40: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    visited.insert(encodeState(startx, starty, boxes));
                   ~~~~~~~~~~~         ^~~~~~
16 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-27 14:13:19
Judged At
2024-11-27 14:13:19
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes