Assertion failed: (ms_Singleton), function getSingleton

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

ma2020
Just popping in
Just popping in
Posts: 8
Joined: Mon Jul 13, 2020 02:07

Assertion failed: (ms_Singleton), function getSingleton

Postby ma2020 » Sun Aug 09, 2020 18:40

Hi, I'm trying to make this simple program:

Code: Select all

#include <CEGUI/CEGUI.h>

using namespace std;
using namespace CEGUI;
int main(int argc, char *argv[]) {
    WindowManager& wmgr = WindowManager::getSingleton();
    Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
    System::getSingleton().getDefaultGUIContext().setRootWindow( myRoot );
    FrameWindow* fWnd = static_cast<FrameWindow*>(wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" ));
    myRoot->addChild( fWnd );
    // position a quarter of the way in from the top-left of parent.
    fWnd->setPosition( UVector2( UDim( 0.25f, 0.0f ), UDim( 0.25f, 0.0f ) ) );
    // set size to be half the size of the parent
    fWnd->setSize( USize( UDim( 0.5f, 0.0f ), UDim( 0.5f, 0.0f ) ) );
    fWnd->setText( "Hello World!" );
    return 0;
}


I did add all the CEGUI library files to the project and was able to build the program. The problem is I see this error message when I try to run the program:

Assertion failed: (ms_Singleton), function getSingleton, file /cegui-0.8.7/cegui/include/CEGUI/Singleton.h, line 78.

This is where it stops:

public:
Singleton( void )
{
assert( !ms_Singleton );
ms_Singleton = static_cast<T*>(this);
}
~Singleton( void )
{ assert( ms_Singleton ); ms_Singleton = 0; }
static T& getSingleton( void )
{ assert( ms_Singleton ); return ( *ms_Singleton ); } //<-------------- stops here
static T* getSingletonPtr( void )
{ return ( ms_Singleton ); }

How to fix this problem?

Additional Info:
OS: Mac OS 10.8
Compiler: Clang 10 (installed via MacPorts)
CEGUI version: 0.8.7
Xcode 5.1.1

orion
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Fri Apr 24, 2020 15:56

Re: Assertion failed: (ms_Singleton), function getSingleton

Postby orion » Thu Jan 28, 2021 21:54

anything in the error log ?

also i cant see if you have added the default resource groups from the code you posted


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests