I have 2 classes written in 2 different files: router.h - router.cpp and topology.h - topology.cpp.
I will show the contents of the .h files because the .cpp ones contain only implementations.
router.h:
#ifndef _ROUTER_H_
#define _ROUTER_H_
#include <map>
#include "topology.h"
using namespace std;
class Router {
public:
int id;
map<Router, int> linkers;
Topology topology;
Router();
Router(int id);
void addLink(Router router, int cost);
void delLink(Router router);
};
#endif
topology.h:
#ifndef _TOPOLOGY_H_
#define _TOPOLOGY_H_
#include "router.h"
class Topology {
public:
map<Router, int> graph;
Topology();
void addNode(Router router, int cost);
void delNode(Router router);
};
#endif
My question is, why at compilation I have an error that is caused by the unrecognized Router and Topology classes, even if I included the headers and I added ifndefs in order to not include files more than one?? I looked up on the internet, on stack also and didn't find anything about this problem.