c++ - Class instance variables inside of class cause compiler errors -
the compiler giving me following complaints following class:
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 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++ 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++ 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++ 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++ 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++ 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++ 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
this should working, i'm including headers classes.
this h file:
//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(); };
thanks
i include main header in widgetbase , main header includes base types before includes widgetbase
it seems not including headers in right order.
c++ sensitive order in identifiers declared. compiler process source file (and #include-s finds along way) in sequential order , every (non-builtin) identifier, compiler must have seen declaration before can use it.
Comments
Post a Comment