定義爲:Class.h全球結構沒有被人看見
#ifndef CLASS_H_
#define CLASS_H_
#include "Class2.h"
#include <iostream>
struct Struct1{
};
struct Struct2{
};
class Class1 {
};
#endif
那麼其他的頭文件,在這裏我用這個:
#ifndef CLASS2_H_
#define CLASS2_H_
#include "Class.h"
class Class2 {
public:
Class2(Struct1* theStruct, Struct2* theStruct2); //Can't find struct definitions
private:
};
#endif
這些都是在同一個目錄。它沒有看到這些結構體定義!他們看起來在全球範圍內對我而言。有人可以向我解釋爲什麼Class2不能看到他們嗎?編譯器不抱怨沒有找到Class的頭部,所以它不能這樣做。
這似乎並不是整個代碼。你有沒有試過這個確切的代碼? ''在哪裏使用? –
2009-08-15 16:16:28
將這些更改爲指針。 – Alex 2009-08-15 16:37:46
整個代碼現在包含在內 – Alex 2009-08-15 16:54:54