Assertion failed: (ms_Singleton), function getSingleton
Posted: Sun Aug 09, 2020 18:40
Hi, I'm trying to make this simple program:
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
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