Record Detail

Compile Error

/in/game.cpp: In function 'bool AddGhost(Game*, int, int, Direction)':
/in/game.cpp:188:11: error: 'Game {aka struct game}' has no member named 'ghosts'
     game->ghosts[game->ghostCount].row = r;
           ^~~~~~
/in/game.cpp:188:24: error: 'Game {aka struct game}' has no member named 'ghostCount'; did you mean 'foodCount'?
     game->ghosts[game->ghostCount].row = r;
                        ^~~~~~~~~~
                        foodCount
/in/game.cpp:189:11: error: 'Game {aka struct game}' has no member named 'ghosts'
     game->ghosts[game->ghostCount].col = c;
           ^~~~~~
/in/game.cpp:189:24: error: 'Game {aka struct game}' has no member named 'ghostCount'; did you mean 'foodCount'?
     game->ghosts[game->ghostCount].col = c;
                        ^~~~~~~~~~
                        foodCount
/in/game.cpp:190:11: error: 'Game {aka struct game}' has no member named 'ghosts'
     game->ghosts[game->ghostCount].dir = direction;
           ^~~~~~
/in/game.cpp:190:24: error: 'Game {aka struct game}' has no member named 'ghostCount'; did you mean 'foodCount'?
     game->ghosts[game->ghostCount].dir = direction;
                        ^~~~~~~~~~
                        foodCount
/in/game.cpp:191:11: error: 'Game {aka struct game}' has no member named 'ghosts'
     game->ghosts[game->ghostCount].scared = false; // 初始状态不害怕
           ^~~~~~
/in/game.cpp:191:24: error: 'Game {aka struct game}' has no member named 'ghostCount'; did you mean 'foodCount'?
     game->ghosts[game->ghostCount].scared = false; // 初始状态不害怕
                        ^~~~~~~~~~
                        foodCount
/in/game.cpp:194:11: error: 'Game {aka struct game}' has no member named 'ghostCount'; did you mean 'foodCount'?
     game->ghostCount++;
           ^~~~~~~~~~
           foodCount
/in/game.cpp: In function 'void MoveGhosts(Game*)':
/in/game.cpp:210:27: error: 'Game {aka struct game}' has no member named 'ghostCount'; did you mean 'foodCount'?
 for (int i = 0; i < game->ghostCount; ++i) {
                           ^~~~~~~~~~
                           foodCount
/in/game.cpp:211:27: error: 'Game {aka struct game}' has no member named 'ghosts'
         Ghost* g = &game->ghosts[i];
                           ^~~~~~
/in/game.cpp:212:19: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         int nr = g->row, nc = g->col;
                   ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:215:14: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         if (g->scared && game->superPowerActive && game->superPowerTurns % 2 == 0) {
              ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:215:32: error: 'Game {aka struct game}' has no member named 'superPowerActive'
         if (g->scared && game->superPowerActive && game->superPowerTurns % 2 == 0) {
                                ^~~~~~~~~~~~~~~~
/in/game.cpp:215:58: error: 'Game {aka struct game}' has no member named 'superPowerTurns'
         if (g->scared && game->superPowerActive && game->superPowerTurns % 2 == 0) {
                                                          ^~~~~~~~~~~~~~~
/in/game.cpp:220:18: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         switch (g->dir) {
                  ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:223:24: error: 'nc' was not declared in this scope
             case left: nc--; break;
                        ^~
/in/game.cpp:223:24: note: suggested alternative: 'nr'
             case left: nc--; break;
                        ^~
                        nr
/in/game.cpp:229:43: error: 'nc' was not declared in this scope
         if (nr < 0 || nr >= game->rows || nc < 0 || nc >= game->columns ||
                                           ^~
/in/game.cpp:229:43: note: suggested alternative: 'nr'
         if (nr < 0 || nr >= game->rows || nc < 0 || nc >= game->columns ||
                                           ^~
                                           nr
/in/game.cpp:232:22: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
             switch (g->dir) {
                      ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:233:27: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
                 case up: g->dir = down; break;
                           ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:234:29: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
                 case down: g->dir = up; break;
                             ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:235:29: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
                 case left: g->dir = right; break;
                             ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:236:30: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
                 case right: g->dir = left; break;
                              ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:242:21: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         game->grid[g->row][g->col] = '.'; // 清除原位置
                     ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:242:29: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         game->grid[g->row][g->col] = '.'; // 清除原位置
                             ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:243:10: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         g->row = nr;
          ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:244:10: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         g->col = nc;
          ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:244:18: error: 'nc' was not declared in this scope
         g->col = nc;
                  ^~
/in/game.cpp:244:18: note: suggested alternative: 'nr'
         g->col = nc;
                  ^~
                  nr
/in/game.cpp:245:21: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         game->grid[g->row][g->col] = '@'; // 幽灵的新位置//
                     ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~
/in/game.cpp:245:29: error: invalid use of incomplete type 'Ghost {aka struct ghost}'
         game->grid[g->row][g->col] = '@'; // 幽灵的新位置//
                             ^~
In file included from /in/game.cpp:5:0:
/in/lab6.h:29:16: note: forward declaration of 'Ghost {aka struct ghost}'
 typedef struct ghost Ghost; // Forward declaration
                ^~~~~

Information

Submit By
Type
Submission
Homework
Lab 6: Pacman
Language
C++
Submit At
2024-12-09 21:23:25
Judged At
2024-12-09 21:23:25
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes