Record Detail

Compile Error

In file included from /in/Compile/check.cpp:7:
/in/sokoban.hpp:99:44: error: implicit conversion loses integer precision: 'unsigned long' to 'std::vector<int, std::allocator<int> >::value_type' (aka 'int') [-Werror,-Wshorten-64-to-32]
                state.boxes.push_back(i*col+j);
                            ~~~~~~~~~ ~~~~~^~
/in/sokoban.hpp:102:37: error: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]
                state.player = i*col+j;
                             ~ ~~~~~^~
/in/sokoban.hpp:120:28: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
        int pos[4][3]={{-1,-col,-col-1},//left upper corner
                           ^~~~
/in/sokoban.hpp:120:28: note: insert an explicit cast to silence this issue
        int pos[4][3]={{-1,-col,-col-1},//left upper corner
                           ^~~~
                           static_cast<int>( )
/in/sokoban.hpp:120:33: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]
        int pos[4][3]={{-1,-col,-col-1},//left upper corner
                                ^~~~~~
/in/sokoban.hpp:120:33: note: insert an explicit cast to silence this issue
        int pos[4][3]={{-1,-col,-col-1},//left upper corner
                                ^~~~~~
                                static_cast<int>( )
/in/sokoban.hpp:121:28: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
                        {1,-col,-col+1},//right upper corner
                           ^~~~
/in/sokoban.hpp:121:28: note: insert an explicit cast to silence this issue
                        {1,-col,-col+1},//right upper corner
                           ^~~~
                           static_cast<int>( )
/in/sokoban.hpp:121:33: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]
                        {1,-col,-col+1},//right upper corner
                                ^~~~~~
/in/sokoban.hpp:121:33: note: insert an explicit cast to silence this issue
                        {1,-col,-col+1},//right upper corner
                                ^~~~~~
                                static_cast<int>( )
/in/sokoban.hpp:122:29: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
                        {-1,col,col-1},//left lower corner
                            ^~~
/in/sokoban.hpp:122:29: note: insert an explicit cast to silence this issue
                        {-1,col,col-1},//left lower corner
                            ^~~
                            static_cast<int>( )
/in/sokoban.hpp:122:33: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]
                        {-1,col,col-1},//left lower corner
                                ^~~~~
/in/sokoban.hpp:122:33: note: insert an explicit cast to silence this issue
                        {-1,col,col-1},//left lower corner
                                ^~~~~
                                static_cast<int>( )
/in/sokoban.hpp:123:28: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
                        {1,col,col+1}};//right lower corner
                           ^~~
/in/sokoban.hpp:123:28: note: insert an explicit cast to silence this issue
                        {1,col,col+1}};//right lower corner
                           ^~~
                           static_cast<int>( )
/in/sokoban.hpp:123:32: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'int' in initializer list [-Wc++11-narrowing]
                        {1,col,col+1}};//right lower corner
                               ^~~~~
/in/sokoban.hpp:123:32: note: insert an explicit cast to silence this issue
                        {1,col,col+1}};//right lower corner
                               ^~~~~
                               static_cast<int>( )
/in/sokoban.hpp:125:32: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            if (board[position+pos[i][0]]=='#'||state.boxes[position+pos[i][0]]=='B'){
                              ~^~~~~~~~~
/in/sokoban.hpp:125:70: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            if (board[position+pos[i][0]]=='#'||state.boxes[position+pos[i][0]]=='B'){
                                                                    ~^~~~~~~~~
/in/sokoban.hpp:128:32: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            if (board[position+pos[i][1]]=='#'||state.boxes[position+pos[i][1]]=='B'){
                              ~^~~~~~~~~
/in/sokoban.hpp:128:70: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            if (board[position+pos[i][1]]=='#'||state.boxes[position+pos[i][1]]=='B'){
                                                                    ~^~~~~~~~~
/in/sokoban.hpp:131:32: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            if (board[position+pos[i][2]]=='#'||state.boxes[position+pos[i][2]]=='B'){
                              ~^~~~~~~~~
/in/sokoban.hpp:131:70: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            if (board[position+pos[i][2]]=='#'||state.boxes[position+pos[i][2]]=='B'){
                                                                    ~^~~~~~~~~
/in/sokoban.hpp:120:28: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
        int pos[4][3]={{-1,-col,-col-1},//left upper corner
                       ~   ^~~~
/in/sokoban.hpp:120:37: error: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]
        int pos[4][3]={{-1,-col,-col-1},//left upper corner
                       ~        ~~~~^~
/in/sokoban.hpp:121:28: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
                        {1,-col,-col+1},//right upper corner
                        ~  ^~~~
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-28 02:35:38
Judged At
2024-11-28 02:35:38
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes