我对发生的错误感到非常困惑。其他人有同样的问题,但我不知道如何在我的情况下解决这个问题。我分享了一些代码:
Node.h:
#ifndef STHG_NODE_H
#define STHG_NODE_H
#include <stdint.h>
#include <vector>
#include "NodeType.h"
#include "Edge.h"
class Node {
public:
Node(const uint32_t id);
~Node();
uint32_t getID() const;
void addOutgoingEdge(Edge *e);
private:
uint32_t id;
std::vector<Edge*> outgoingEdges;
};
#endif //STHG_NODE_H
Edge.h:
#ifndef STHG_EDGE_H
#define STHG_EDGE_H
#include "Node.h"
class Edge {
public:
Edge(Node *first, Node *second);
~Edge();
private:
UCNode *first;
UCNode *second;
};
#endif //STHG_EDGE_H
错误如下:
Edge.h:12:15: error: expected ')' before '*' token
Edge(Node *first, Node *second);
我想了解为什么会出现这种错误以及将来如何防止它。