error: 'IGraphParser' has not been declared

Hi,
this is an error I am not able to understand. I am defining as a parameter of a method a pointer to an object of class 'IGraphParser' but the compiler throws the errors:
..\/Graph.h:47:35: error: 'IGraphParser' has not been declared
..\/Graph.h:60:30: error: 'IGraphParser' has not been declared
these error regards the private method parse and the constructor

where Graph.h is :
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
#ifndef GRAPH_H_
#define GRAPH_H_

#include "Common.h"
#include "GraphParsers.h"
#include "MyFunctions.h"
#include <fstream>

// defined classes
class Graph; // Graph.h
class GraphException; // Graph.h
class Node; // Graph.h
class Edge; // Graph.h


class Graph {

private:
	std::vector<Node*> nodes;

	uint nodesLength;


	void parse(const char* filename, IGraphParser* parser) throw(GraphException);

	Node* setAndGet(uint pos);

public:
	Graph(const char* filename, IGraphParser* parser) throw(GraphException);


	//...

};


typedef std::vector<Edge>::iterator EdgesIterator;

class Node { /* ... */ }
class Edge{ /* .... */ }

#endif /* GRAPH_H_ */ 


But IGraphParser is really declared, the name is well-typed and the include path works. This is the header "GraphParsers.h" :
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
#ifndef GRAPHPARSERS_H_
#define GRAPHPARSERS_H_

#include "Common.h"
#include "Graph.h"
#include <fstream>

class IGraphParser;
class AbstractTextFileParser;
class SimpleGraphParser;

class IGraphParser {
public:
	struct NextEdge{
		long node1;
		long node2;
		long weight;
	};


	virtual void open(const char* fileName) = 0;

	virtual void close()= 0;

	virtual bool hasNext() = 0;

	virtual NextEdge& next() = 0;
};


class AbstractTextFileParser : public IGraphParser{ /* ... */ };

class SimpleGraphParser : public AbstractTextFileParser{ /* ... */ }

#endif /* GRAPHPARSERS_H_ */ 


Anyone can figure out the origin of this problem?
Thanks for any consideration
- Atari
Last edited on
The error is occurring because "GraphParsers.h" is including "Graph.h".
Last edited on
thanks shacktar!
Topic archived. No new replies allowed.