Record Detail

Compile Error

/in/game.cpp:264:12: error: using typedef-name 'GameState' after 'enum'
 enum class GameState { EMPTY, FOOD, Ghost };
            ^~~~~~~~~
In file included from /in/game.cpp:5:0:
/in/lab6.h:16:50: note: 'GameState' has a previous declaration here
 typedef enum gameState{losing, onGoing, winning} GameState;
                                                  ^~~~~~~~~
/in/game.cpp:270:12: error: using typedef-name 'Direction' after 'enum'
 enum class Direction { UP, DOWN, LEFT, RIGHT };
            ^~~~~~~~~
In file included from /in/game.cpp:5:0:
/in/lab6.h:17:53: note: 'Direction' has a previous declaration here
 typedef enum direction{up, down, left, right, idle} Direction;
                                                     ^~~~~~~~~
/in/game.cpp: In function 'bool AddGhost(Game*, int, int, Direction)':
/in/game.cpp:281:21: error: 'UP' is not a member of 'Direction {aka direction}'
     case Direction::UP:
                     ^~
/in/game.cpp:285:21: error: 'DOWN' is not a member of 'Direction {aka direction}'
     case Direction::DOWN:
                     ^~~~
/in/game.cpp:289:21: error: 'LEFT' is not a member of 'Direction {aka direction}'
     case Direction::LEFT:
                     ^~~~
/in/game.cpp:293:21: error: 'RIGHT' is not a member of 'Direction {aka direction}'
     case Direction::RIGHT:
                     ^~~~~
/in/game.cpp:301:54: error: 'FOOD' is not a member of 'GameState {aka gameState}'
         if (game->grid[next_r][next_c] == GameState::FOOD) {
                                                      ^~~~
/in/game.cpp:302:53: error: 'Ghost' is not a member of 'GameState {aka gameState}'
             game->grid[next_r][next_c] = GameState::Ghost;  // ����ʳ��
                                                     ^~~~~
/in/game.cpp:304:59: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
         else if (game->grid[next_r][next_c] == GameState::EMPTY) {
                                                           ^~~~~
/in/game.cpp:305:53: error: 'Ghost' is not a member of 'GameState {aka gameState}'
             game->grid[next_r][next_c] = GameState::Ghost;  // �ڿ�λ�����ӹ���
                                                     ^~~~~
/in/game.cpp:310:39: error: 'Ghost' is not a member of 'GameState {aka gameState}'
         game->grid[r][c] = GameState::Ghost;  // �ڵ�ǰλ�����ӹ���
                                       ^~~~~
/in/game.cpp: In function 'void MoveGhosts(Game*)':
/in/game.cpp:339:48: error: 'Ghost' is not a member of 'GameState {aka gameState}'
             if (game->grid[r][c] == GameState::Ghost) {
                                                ^~~~~
/in/game.cpp:341:66: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                 if (r > 0 && (game->grid[r - 1][c] == GameState::EMPTY || game->grid[r - 1][c] == GameState::FOOD)) {
                                                                  ^~~~~
/in/game.cpp:341:110: error: 'FOOD' is not a member of 'GameState {aka gameState}'
                 if (r > 0 && (game->grid[r - 1][c] == GameState::EMPTY || game->grid[r - 1][c] == GameState::FOOD)) {
                                                                                                              ^~~~
/in/game.cpp:343:51: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                     game->grid[r][c] = GameState::EMPTY;  // �����Ƴ���ǰλ��
                                                   ^~~~~
/in/game.cpp:344:55: error: 'Ghost' is not a member of 'GameState {aka gameState}'
                     game->grid[r - 1][c] = GameState::Ghost;  // �����Ƶ��Ϸ�λ��
                                                       ^~~~~
/in/game.cpp:347:73: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                 if (r < rows - 1 && (game->grid[r + 1][c] == GameState::EMPTY || game->grid[r + 1][c] == GameState::FOOD)) {
                                                                         ^~~~~
/in/game.cpp:347:117: error: 'FOOD' is not a member of 'GameState {aka gameState}'
                 if (r < rows - 1 && (game->grid[r + 1][c] == GameState::EMPTY || game->grid[r + 1][c] == GameState::FOOD)) {
                                                                                                                     ^~~~
/in/game.cpp:349:51: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                     game->grid[r][c] = GameState::EMPTY;  // �����Ƴ���ǰλ��
                                                   ^~~~~
/in/game.cpp:350:55: error: 'Ghost' is not a member of 'GameState {aka gameState}'
                     game->grid[r + 1][c] = GameState::Ghost;  // �����Ƶ��·�λ��
                                                       ^~~~~
/in/game.cpp:353:66: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                 if (c > 0 && (game->grid[r][c - 1] == GameState::EMPTY || game->grid[r][c - 1] == GameState::FOOD)) {
                                                                  ^~~~~
/in/game.cpp:353:110: error: 'FOOD' is not a member of 'GameState {aka gameState}'
                 if (c > 0 && (game->grid[r][c - 1] == GameState::EMPTY || game->grid[r][c - 1] == GameState::FOOD)) {
                                                                                                              ^~~~
/in/game.cpp:355:51: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                     game->grid[r][c] = GameState::EMPTY;  // �����Ƴ���ǰλ��
                                                   ^~~~~
/in/game.cpp:356:55: error: 'Ghost' is not a member of 'GameState {aka gameState}'
                     game->grid[r][c - 1] = GameState::Ghost;  // �����Ƶ����λ��
                                                       ^~~~~
/in/game.cpp:359:73: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                 if (c < cols - 1 && (game->grid[r][c + 1] == GameState::EMPTY || game->grid[r][c + 1] == GameState::FOOD)) {
                                                                         ^~~~~
/in/game.cpp:359:117: error: 'FOOD' is not a member of 'GameState {aka gameState}'
                 if (c < cols - 1 && (game->grid[r][c + 1] == GameState::EMPTY || game->grid[r][c + 1] == GameState::FOOD)) {
                                                                                                                     ^~~~
/in/game.cpp:361:51: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                     game->grid[r][c] = GameState::EMPTY;  // �����Ƴ���ǰλ��
                                                   ^~~~~
/in/game.cpp:362:55: error: 'Ghost' is not a member of 'GameState {aka gameState}'
                     game->grid[r][c + 1] = GameState::Ghost;  // �����Ƶ��ұ�λ��
                                                       ^~~~~
/in/game.cpp: In function 'bool AddCapsule(Game*, int, int)':
/in/game.cpp:396:40: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
     if (game->grid[r][c] != GameState::EMPTY && game->grid[r][c] != GameState::FOOD) {
                                        ^~~~~
/in/game.cpp:396:80: error: 'FOOD' is not a member of 'GameState {aka gameState}'
     if (game->grid[r][c] != GameState::EMPTY && game->grid[r][c] != GameState::FOOD) {
                                                                                ^~~~
/in/game.cpp:401:35: error: 'CAPSULE' is not a member of 'GameState {aka gameState}'
     game->grid[r][c] = GameState::CAPSULE;
                                   ^~~~~~~
/in/game.cpp:405:11: error: 'Game {aka struct game}' has no member named 'superpowerTimer'
     game->superpowerTimer = 10;
           ^~~~~~~~~~~~~~~
/in/game.cpp:409:48: error: 'Ghost' is not a member of 'GameState {aka gameState}'
             if (game->grid[i][j] == GameState::Ghost) {
                                                ^~~~~
/in/game.cpp:410:47: error: 'EMPTY' is not a member of 'GameState {aka gameState}'
                 game->grid[i][j] = GameState::EMPTY;  // ���ֱ�Ϊ��λ
                                               ^~~~~

Information

Submit By
Type
Submission
Homework
Lab6: Pac-man
Language
C++
Submit At
2023-12-06 18:35:50
Judged At
2023-12-06 18:35:50
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes