Okay so I'm getting these errors because of the serialization stuff:Code:#ifndef MENU_H #define MENU_H #include "Object.h" #include <string> #include <list> class Menu : public CObject { public: Menu(){}; Menu(std::string mSelection) { mSelection = Selection; } virtual ~Menu() { Destroy(); } // deletes self void Release() { delete this; } // call update on all children virtual void Update() { for( std::list<Menu*>::iterator i = MenuChoices.begin(); i != MenuChoices.end(); i++ ) { (*i)->Update(); } } // recursively destroy all children and self void Destroy() { for( std::list<Menu*>::iterator i = MenuChoices.begin(); i != MenuChoices.end(); i++ ) (*i)->Release(); MenuChoices.clear(); } // add a child void MenuSelection( Menu* MenuSelection ) { MenuSelection->SetRootMenu(this); MenuChoices.push_back(MenuSelection); } // Set the parent of the child void SetRootMenu(Menu* Root) { RootMenu = Root; } protected: DECLARE_SERIAL(Menu) // list of children std::list<Menu*> MenuChoices; // pointer to parent Menu * RootMenu; std::string Selection; void Serialize( CArchive& archive ); }; #endif
According to the MFC website this should work without a hitch, the only thing I'm doing differently is making a vector available for serialization. Any help?Code:------ Build started: Project: TextGame, Configuration: Debug Win32 ------ Compiling... Main.cpp c:\documents and settings\home\my documents\visual studio 2005\projects\textgame\textgame\menu_object.h(60) : error C2143: syntax error : missing ';' before 'std::list<_Ty>' with [ _Ty=Menu * ] c:\documents and settings\home\my documents\visual studio 2005\projects\textgame\textgame\menu_object.h(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\documents and settings\home\my documents\visual studio 2005\projects\textgame\textgame\menu_object.h(60) : warning C4183: 'DECLARE_SERIAL': missing return type; assumed to be a member function returning 'int' c:\documents and settings\home\my documents\visual studio 2005\projects\textgame\textgame\menu_object.h(65) : error C2061: syntax error : identifier 'CArchive' Build log was saved at "file://c:\Documents and Settings\Home\My Documents\Visual Studio 2005\Projects\TextGame\TextGame\Debug\BuildLog.htm" TextGame - 3 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



LinkBack URL
About LinkBacks




CornedBee