我用下面的頭Node.h
:枚舉尚未聲明
/*
INCLUDE PROTECTION
*/
#ifndef NODE_H_INCLUDED
#define NODE_H_INCLUDED
/*
Include
*/
#include <vector>
#include <unordered_map>
//#include "NodeConnection.h"
#include "Tile.h"
#include "Network.h"
/*
Declarations
*/
class Network;
class NodeConnection;
class Node {
private:
Tile* tile;
std :: vector <NodeConnection*> connections;
std :: unordered_map <Node*, NodeConnection*> connectionmap;
public:
/* Enumeration */
enum NAVIGATION {
RIGHT = 0,
UP = 1,
LEFT = 2,
DOWN = 3
};
Node (Tile* _tile);
void FindNeighbours(Board* board, Network* network);
void SetNodeConnection(Node* node, NodeConnection* nodeconnection);
};
struct TileNavigation {
Tile* tile;
enum Node :: NAVIGATION navigation;
};
#endif
而且在NodeConnection.h
頭以下:
/*
INCLUDE PROTECTION
*/
#ifndef NODECONNECTION_H_INCLUDED
#define NODECONNECTION_H_INCLUDED
/*
Include
*/
#include <string>
#include "Node.h"
/*
Declarations
*/
class Node;
struct Nodes;
enum ConnectionType {
WALLCONN, PATHCONN, UNKNOWN
};
class NodeConnection {
private:
enum ConnectionType contype;
struct Nodes;
public:
//NodeConnection();
NodeConnection (Node* a, Node* b, NAVIGATION initial_nav);
};
struct Nodes {
Node* left;
Node* right;
std :: string steps;
};
#endif
我試圖Node :: NAVIGATION
和NAVIGATION
,卻不失它不斷地說我那
" 'NAVIGATION' has not been declared "
有沒有人知道wha我做錯了嗎?預先感謝指針。
Node :: NAVIGATION應該工作... –
你可以提供一個[SSCCE](http://sscce.org/)你的示例代碼中有一些細節丟失,使用'Node :: NAVIGATION' [should work看現場實例](http://coliru.stacked-crooked.com/a/38b1ce66e5f99f30)。 –
'NodeConnection(Node * a,Node * b,Node :: NAVIGATION initial_nav);'不起作用,它給出相同的錯誤 – bas