Record Detail

Compile Error

In file included from /in/Compile/check.cpp:7:
/in/sokoban.hpp:42:13: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
    if (map[x][y] == '#') return false;  // 墙壁
        ~~~ ^
/in/sokoban.hpp:42:16: 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 (map[x][y] == '#') return false;  // 墙壁
        ~~~    ^
/in/sokoban.hpp:41:29: error: comparison of integers of different signs: 'int' and 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (x < 0 || y < 0 || x >= map.size() || y >= map[0].size()) return false;
                          ~ ^  ~~~~~~~~~~
/in/sokoban.hpp:41:48: error: comparison of integers of different signs: 'int' and 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (x < 0 || y < 0 || x >= map.size() || y >= map[0].size()) return false;
                                             ~ ^  ~~~~~~~~~~~~~
/in/sokoban.hpp:64:16: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
    map.resize(rows);
        ~~~~~~ ^~~~
/in/sokoban.hpp:66:20: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
        cin >> map[i];
               ~~~ ^
/in/sokoban.hpp:68:21: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            if (map[i][j] == 'S') {
                ~~~ ^
/in/sokoban.hpp:68:24: 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 (map[i][j] == 'S') {
                ~~~    ^
/in/sokoban.hpp:70:21: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                map[i][j] = '.';  // 清除起点
                ~~~ ^
/in/sokoban.hpp:70:24: 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]
                map[i][j] = '.';  // 清除起点
                ~~~    ^
/in/sokoban.hpp:71:28: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            } else if (map[i][j] == 'B') {
                       ~~~ ^
/in/sokoban.hpp:71:31: 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]
            } else if (map[i][j] == 'B') {
                       ~~~    ^
/in/sokoban.hpp:73:21: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                map[i][j] = '.';  // 清除箱子位置
                ~~~ ^
/in/sokoban.hpp:73:24: 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]
                map[i][j] = '.';  // 清除箱子位置
                ~~~    ^
/in/sokoban.hpp:74:28: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            } else if (map[i][j] == 'T') {
                       ~~~ ^
/in/sokoban.hpp:74:31: 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]
            } else if (map[i][j] == 'T') {
                       ~~~    ^
/in/sokoban.hpp:76:21: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
                map[i][j] = '.';  // 清除目标位置
                ~~~ ^
/in/sokoban.hpp:76:24: 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]
                map[i][j] = '.';  // 清除目标位置
                ~~~    ^
/in/sokoban.hpp:100:56: error: implicit conversion changes signedness: 'int' to 'std::vector::size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
            int nx = current.player.first + directions[i].first;
                                            ~~~~~~~~~~ ^
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 11:39:10
Judged At
2024-11-26 11:39:10
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes