這是怎麼回事?C++中的未知類型錯誤
#include "MyClass.h"
class MyOtherClass {
public:
MyOtherClass();
~MyOtherClass();
MyClass myVar; //Unknown type Error
};
突然,當我包含.h並寫入該var Xcode給了我噸的錯誤...還有未知類型的錯誤。
當.h包含在那裏時,它怎麼可能是未知的?
這裏是NodeButton.h文件,該文件將對應於MyClass.h的例子
#pragma once
#include "cinder/Vector.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Texture.h"
#include "cinder/Color.h"
#include "cinder/ImageIo.h"
#include "cinder/Timeline.h"
#include "cinder/app/AppBasic.h"
#include "cinder/App/App.h"
#include "Node.h"
#include "CursorMano.h"
using namespace ci;
using namespace ci::app;
using namespace std;
using namespace is;
typedef boost::shared_ptr<class NodeButton> NodeButtonRef;
class NodeButton : public Node2D
{
public:
NodeButton (CursorMano *cursor, string imageUrl, bool fadeIn = false, float delay = 0.0f);
virtual ~NodeButton();
//methods
void update(double elapsed);
void draw();
void setup();
//events
bool mouseMove(ci::app::MouseEvent event);
//vars
CursorMano *mCursor;
gl::Texture mImageTexture;
Anim<float> mAlpha = 1.0f;
bool mSelected = false;
private:
};
這裏是CursorMano.h的這將對應的例子MyOtherClass.h內容。
#pragma once
#include <list>
#include <vector>
#include "cinder/app/AppBasic.h"
#include "cinder/qtime/QuickTime.h"
#include "cinder/gl/Texture.h"
#include "cinder/Vector.h"
#include "NodeButton.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class CursorMano {
public:
CursorMano (AppBasic *app);
~CursorMano();
void mueveMano(Vec2i);
void update();
void draw();
void play(int button);
void reset(int button);
Vec2i mMousePos;
NodeButton mButtonCaller; //this gives the unknow type error
private:
AppBasic *mApp;
gl::Texture mFrameTexture;
qtime::MovieGl mMovie;
int mIdButton;
};
「MyClass.h」的內容是什麼?另外'MyOtherClass'和它的ctor-dtor的拼寫不匹配! – iammilind 2012-02-07 05:13:54
你能告訴我們'MyClass.h'嗎? – birryree 2012-02-07 05:13:54
我們需要更多的代碼來幫助解決這個問題。你能告訴我們MyClass.h的全部內容和這個頭文件的全部內容嗎? – templatetypedef 2012-02-07 05:14:16