unknown error while defining a constructor

This week i was working on a console based snake game. i created graphics.h,snake.h and mouse.h classes for my project. in the snake class i had a constructor with a char and graphics parameters and it worked fine. but when i create a constructor for the mouse class with a char and a graphics parameter the compiler says syntax error: identifier 'graphics'.
here is the code for the classes.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  //the snake.h 
#ifndef SNAKE_H
#define SNAKE_H
#include "Graphics.h"
#include "Mouse.h"
class Snake
{
    friend Graphics* operator<< (Graphics*,const Snake &);
    friend Graphics& operator<< (Graphics&,const Snake &);
    public:
        enum direction{UP,DOWN,LEFT,RIGHT};
        Snake(char,Graphics&); // this constructor works fine
        ~Snake();
        bool move(direction);
        bool eats(Mouse&);
    protected:

    private:
        char snake;
        int** snakelocs;
        int snake_length;
        Graphics &gfx;
};

#endif // SNAKE_H
//the mouse.h
#ifndef MOUSE_H
#define MOUSE_H
#include "Graphics.h"
class Mouse
{
    public:
        Mouse(char,Graphics &); // this is the source of the error
        ~Mouse();
        void on_eaten();
        const int* get_loc();
        char get_mouse();
    protected:

    private:
        char mouse;
        int* loc;
        Graphics &gfx; // there is an error here too. i tried initializing it in the constructor as mouse(char x,Graphics g):mouse(x),gfx(g){}
};

#endif // MOUSE_H 
syntax error: identifier 'graphics'.


This code contains no graphics. It does have Graphics. Case matters. What does the error say, exactly?
Sorry for the case mistake.
in eclipse it says 'Graphics has not been declared' for the constructor and
'Graphics does not name a type' for the declaration of the member variable Graphics &gfx.
i have included the header file 'Graphics.h' in the mouse.h file.
And what does the Graphics.h file look like?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <iostream>
#include "Mouse.h"
using namespace std;
class Graphics
{
	friend ostream& operator<<(ostream&, const Graphics &);
	friend ostream& operator<<(ostream&, const Graphics*);
public:
	Graphics(int, int);
	~Graphics();
	void putPixel(char, int, int);
	void clear();
	int get_width();
	int get_height();
	Graphics& operator<< (Mouse &);
protected:

private:
	char** pixels;
	int height, width;
};

#endif // GRAPHICS_H


Topic archived. No new replies allowed.