編譯器給我說說下面的類以下的投訴:類實例變量內部類的原因編譯器錯誤
class AguiWidgetBase
{
//variables
AguiColor tintColor;
AguiColor fontColor;
//private methods
void zeroMemory();
virtual void onPaint();
virtual void onTintColorChanged(AguiColor color);
void (*onPaintCallback)(AguiRectangle clientRect);
void (*onTintColorChangedCallback)();
public:
AguiWidgetBase(void);
~AguiWidgetBase(void);
void paint();
void setTintColor(AguiColor color);
AguiColor getBackColor();
};
Warning 13 warning C4183: 'getBackColor': missing return type; assumed to be a member function returning 'int' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 26
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 11
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 11
Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 12
Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 12
Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 26
Error 12 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 26
Error 1 error C2146: syntax error : missing ';' before identifier 'tintColor' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 11
Error 10 error C2146: syntax error : missing ';' before identifier 'getBackColor' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 26
Error 4 error C2146: syntax error : missing ';' before identifier 'fontColor' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 12
Error 8 error C2061: syntax error : identifier 'AguiRectangle' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 17
Error 7 error C2061: syntax error : identifier 'AguiColor' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 16
Error 9 error C2061: syntax error : identifier 'AguiColor' c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\AguiWidgetBase.h 25
這應該是工作,我包括頭這些類。
這是.h文件:
//integer Point class
class AguiPoint {
int x;
int y;
public:
int getX();
int getY();
void setX(int x);
void setY(int y);
void set(int x, int y);
AguiPoint(int x, int y);
AguiPoint();
std::string toString();
std::string xToString();
std::string yToString();
};
//floating version of Agui Point
class AguiPointf {
float x;
float y;
public:
float getX();
float getY();
void setX(float x);
void setY(float y);
void set(float x, float y);
AguiPointf(float x, float y);
AguiPointf(AguiPoint p);
AguiPointf();
std::string toString();
std::string xToString();
std::string yToString();
};
//Integer rectangle class
class AguiRectangle {
int x;
int y;
int width;
int height;
public:
bool isEmpty();
int getTop();
int getLeft();
int getBottom();
int getRight();
AguiPoint getTopLeft();
AguiPoint getBottomRight();
};
class AguiColor {
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
void verifyColorBounds();
public:
AguiColor(int r, int g, int b, int a);
AguiColor(float r, float g, float b, float a);
AguiColor();
int getR();
int getG();
int getB();
int getA();
};
感謝
我包括在WidgetBase和主標題主標題包括基本類型,它包括了widgetbase
您是否包含AguiColor的正確頭文件? – 2010-10-07 11:34:12