Sleepy programmer (self - acclaimed) need help
#ifndef GAME_H
#define GAME_H
#include <iostream>
#include "snake.h"
#include "food.h"
#define MAX_WIDTH 20
#define MAX_HEIGHT 20
class game
{
public:
game();
static void createBoard();
int gameStart();
bool gameChecker();
protected:
food apple;
bool gameOver = false;
snake python;
int gameSpeed = 250;
private:
};
#endif // GAME_H
Above is header file called game.h
Whenever I try to compile the project it shows error saying "error: 'food' does not name a type"
where food is another class which I have included in this header file too
#include 'food.h'
but still the error persists. I also, tried include the food.h in .cpp file of the game but still no hope.
this is the food.h file in case you need it
#ifndef FOOD_H
#define FOOD_H
#include "game.h"
#include "snakeFragment.h"
#include <stdlib.h>
#include <time.h>
class food: public snakeFragment
{
public:
food();
int foodPlace();
int printFood();
protected:
char symbol = '*';
private:
};
#endif // FOOD_H
I am using Code::blocks.
Things I have done
Reparse the project
Rebuild the entire project
Rewriting the class again
Restarting the laptop
Restarting Code::blocks
Provided the path in the compiler settings -> search directories
but none worked. I don't know what is the problem ?
Thanks in advance