CEGUI::Singleton inheritence

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

Sotai
Just popping in
Just popping in
Posts: 2
Joined: Fri May 19, 2006 10:16
Location: Sweden
Contact:

CEGUI::Singleton inheritence

Postby Sotai » Sun May 21, 2006 09:44

Hi, I'm part in a team that's developing a game the uses CEGUI. And I noticed that the class CEGUI::Singleton class existed and I thought it would be neat if i could use that. But is it possible to inherit this class from the libraries and not the sourcec version of CEGUI, because I get some odd linker errors. Here my class definition code:

Code: Select all

class gGUIManager : public CEGUI::Singleton<gGUIManager>
{
private:
   static gGUIManager guiMgr;

   CEGUI::OpenGLRenderer *renderer;
   CEGUI::Window *rootWnd;
   CEGUI::WindowManager *wndMgr;
   bool initialized;

public:
   gGUIManager(int w, int h);
};

Heres the contructor code:

Code: Select all

gGUIManager::gGUIManager(int w, int h)
{
   static_cast<gGUIManager*>(this->ms_Singleton)->renderer =
      new CEGUI::OpenGLRenderer(0, w, h);
   new CEGUI::System(static_cast<gGUIManager*>(this->ms_Singleton)->renderer);

   static_cast<gGUIManager*>(this->ms_Singleton)->wndMgr = CEGUI::WindowManager::getSingletonPtr();
}


Heres the errors:

Code: Select all

Error   1   error LNK2001: unresolved external symbol "__declspec(dllimport) protected: static class gGUIManager * CEGUI::Singleton<class gGUIManager>::ms_Singleton" (__imp_?ms_Singleton@?$Singleton@VgGUIManager@@@CEGUI@@1PAVgGUIManager@@A)   release.obj   

Error   2   error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CEGUI::Singleton<class gGUIManager>::~Singleton<class gGUIManager>(void)" (__imp_??1?$Singleton@VgGUIManager@@@CEGUI@@QAE@XZ)   release.obj   

Error   3   error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CEGUI::Singleton<class gGUIManager>::Singleton<class gGUIManager>(void)" (__imp_??0?$Singleton@VgGUIManager@@@CEGUI@@QAE@XZ)   release.obj   

Error   4   fatal error LNK1120: 3 unresolved externals   C:\Documents and Settings\jimsag01\Mina dokument\c++\VS Projects\gEngine\\bin\release\gEngine.exe   


Are there some methods I need to override maybe?

Anyone have a clue?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Sun May 21, 2006 16:28

A singleton template is really simple to write. I would suggest you do that instead.

But you're not using it correctly either. Take a look at the CEGUI sources and see what they do.

It's mostly involving the ms_Singleton member.

HTH


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 7 guests