Unhandled execption on System::create()

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

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Unhandled execption on System::create()

Postby RickP » Sat Mar 13, 2010 06:00

So I'm getting:
Unhandled exception at 0x7c812afb in CEGUITest-Debug.exe: Microsoft C++ exception: CEGUI::GenericException at memory location 0x0013ef88..

OpenGLRenderer& renderer = OpenGLRenderer::create();
System::create(renderer); // this line gives error. renderer is a valid object

What library is this in? I know this is a very generic error so not sure if anyone has any ideas.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Unhandled execption on System::create()

Postby CrazyEddie » Sat Mar 13, 2010 09:15

Hi,

You should use try/catch blocks around your code so you can output the message from the exception to discover why the exception was thrown.

In this case I'm going to tell you that it's because the XML parser or Image Codec DLL can't be found- so for the default builds CEGUIExpatParser and CEGUISILLYImageCodec + SILLY dlls (or the _d suffixed versions for debug builds) need to be in the working directory. Note also that the MSVC++ debugger working directory defaults to a location other than where the executable resides.

CE.

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sat Mar 13, 2010 12:49

Thank you again. I assume you knew what I was missing because of my other post :)

Note also that the MSVC++ debugger working directory defaults to a location other than where the executable resides.

I actually setup my project so the main exe is put at the root directory of my project to make things like this easier. It's also how the graphics library I use sets up their projects since they require a few dependencies.

Thanks again Crazy. You are probably one of the most helpful authors of software out there. Very respectful to newbies also :)


I'm hoping to get this working with Leadwerks Engine, which uses OpenGL.

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sat Mar 13, 2010 13:16

What object should we use for these exceptions?

I tried CEGUI::Exception but it didn't seem to return anything for this exception that is being thrown at the following line:

FrameWindow* fWnd = reinterpret_cast<FrameWindow*>(wmgr.createWindow("TaharezLook/FrameWindow", "testWindow"));

Any ideas? I copied the datafiles to the directory where my exe is (the root in my case), but got the same error.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Unhandled execption on System::create()

Postby CrazyEddie » Sat Mar 13, 2010 16:13

In 0.7.x you can use CEGUI::Exception or std::exception. I'm not sure what the issue might be here, what's the exact type of exception that's being thrown (according to the debugger)?

A wild guess might be that you didn't load the TaharezLook.scheme? Are you following the tutorials, or...?

CE.

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sat Mar 13, 2010 17:03

It's an UnknownObjectException that's being thrown.

I'm following http://www.cegui.org.uk/docs/current/wi ... orial.html tutorial but I don't see anything about loading a scheme. I assume it's http://www.cegui.org.uk/docs/current/da ... orial.html. Where do I put this stuff? I assume after I created the renderer and before I create a window?

It seems the tutorials are kind of scattered source chuncks. It would be really helpful to show a very small source example of getting a basic window with a button up. All the includes needed (I've been able to figure most out, but it's a trial and error method on my part with following the tutorials and finding a header file that's named the same as the class because the tutorials don't seem to tell you what header files are needed). I can understand the difficultly in making tutorials since people could be using any rendering engine, but I would think a basic example with maybe just comments where the engine specific stuff would go. Seeing the order of the CEGUI function calling and the includes I think would be pretty handy.

There are so many options for CEGUI and many different ways to do something that it's a little confusing to me right at the moment.


So here is my small little chunk of code. Getting an error with SchemeManager. Does the SchemeManager class look in thte datafiles/schemes folder by default or do I need to either add the path to the function parameter or move the scheme file outside of the datafiles/schemes and at the root exe level?

Code: Select all

try
   {
      OpenGLRenderer& renderer = OpenGLRenderer::create();
      System::create(renderer);
   }
   catch(CEGUI::Exception e)
   {
   }

   SchemeManager::getSingleton().create("TaharezLook.scheme");            // This is giving an error of InvalidRequestException

   WindowManager& wmgr = WindowManager::getSingleton();
   Window* myRoot = wmgr.createWindow("DefaultWindow", "root");
   System::getSingleton().setGUISheet(myRoot);

   FrameWindow* fWnd = reinterpret_cast<FrameWindow*>(wmgr.createWindow("TaharezLook/FrameWindow", "testWindow"));

   myRoot->addChildWindow(myRoot);

   fWnd->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );
   fWnd->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );
   fWnd->setText( "Hello World!" );

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sat Mar 13, 2010 17:26

OK, here is my new code after checking out tutorials 1-4 I think.

At line SchemeManager::getSingleton().create("TaharezLook.scheme"); I'm getting InvalidRequestException thrown. Any ideas?

Code: Select all

try
   {
      OpenGLRenderer& renderer = OpenGLRenderer::create();
      System::create(renderer);
   }
   catch(CEGUI::Exception e)
   {
   }

   // initialise the required dirs for the DefaultResourceProvider
   DefaultResourceProvider* rp = static_cast<DefaultResourceProvider*>
    (System::getSingleton().getResourceProvider());

   rp->setResourceGroupDirectory("schemes", "../datafiles/schemes/");
   rp->setResourceGroupDirectory("imagesets", "../datafiles/imagesets/");
   rp->setResourceGroupDirectory("fonts", "../datafiles/fonts/");
   rp->setResourceGroupDirectory("layouts", "../datafiles/layouts/");
   rp->setResourceGroupDirectory("looknfeels", "../datafiles/looknfeel/");
   rp->setResourceGroupDirectory("lua_scripts", "../datafiles/lua_scripts/");

   // This is only needed if you are using Xerces and need to
   // specify the schemas location
   rp->setResourceGroupDirectory("schemas", "../../XMLRefSchema/");

   // set the default resource groups to be used
   CEGUI::Imageset::setDefaultResourceGroup("imagesets");
   CEGUI::Font::setDefaultResourceGroup("fonts");
   CEGUI::Scheme::setDefaultResourceGroup("schemes");
   CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
   CEGUI::WindowManager::setDefaultResourceGroup("layouts");
   CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");

   // Again, you only need to this one if you are using xerces and have
   // defined a group for schemas.
   CEGUI::XercesParser::setSchemaDefaultResourceGroup("schemas");

   SchemeManager::getSingleton().create("TaharezLook.scheme");

   WindowManager& wmgr = WindowManager::getSingleton();
   Window* myRoot = wmgr.createWindow("DefaultWindow", "root");
   System::getSingleton().setGUISheet(myRoot);

   //FrameWindow* fWnd = reinterpret_cast<FrameWindow*>(wmgr.createWindow("TaharezLook/FrameWindow", "testWindow"));
   Window* fWnd = wmgr.createWindow("TaharezLook/FrameWindow", "testWindow");
   
   myRoot->addChildWindow(myRoot);

   fWnd->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );
   fWnd->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );
   fWnd->setText( "Hello World!" );

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Unhandled execption on System::create()

Postby CrazyEddie » Sat Mar 13, 2010 21:09

What does the CEGUI.log file say?

CE.

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sat Mar 13, 2010 21:21

Ah I didn't even notice that log

DefaultResourceProvider::load - TaharezLook.scheme does not exist


So it seems it can't find that scheme. I have the 'datafiles' dir and everything under it at my root level which is where I have the exe conifgured to go also. Do I need to take stuff out of the 'datafiles' dir or does the underlying code automatically look inside this dir?

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sat Mar 13, 2010 21:49

Oh I think I see that you are expecting the datafiles dir to be up a dir from the exe. So I removed the .. from those paths. I wasn't sure about rp->setResourceGroupDirectory("schemas", "../../XMLRefSchema/"); I couldn't seem to find that XMLRefSchema dir anywhere so I left it, but got the same error.

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sun Mar 14, 2010 12:51

OK, I got past the errors.

This
rp->setResourceGroupDirectory("schemas", "../../XMLRefSchema/");

Needed to be this
rp->setResourceGroupDirectory("schemas", "datafiles/xml_schemas/");

And I needed to remove the prefix of '/' from my resource groups.

So now I don't get any errors but I don't see anything on screen. I'll probably have to do some OpenGL stuff since this engine hides all that.

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sun Mar 14, 2010 13:18

Sweet! Got it working. Thanks for your help CE. This is exciting.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Unhandled execption on System::create()

Postby CrazyEddie » Sun Mar 14, 2010 17:09

It's good you have it working. It seems there was some confusion over the 'old' location of the XML schemas, and the new location. In general for 0.7.x code, currently the main docs are the only source of reliable information - most of the Wiki for example is still geared towards the previous versions.

CE.

RickP
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Sat Mar 13, 2010 03:52

Re: Unhandled execption on System::create()

Postby RickP » Sun Mar 14, 2010 22:50

Yeah I think some of it was a case of reading the old tutorials. Do you have anything that shows how to use the widgets? I tried guessing and tried something like:

Window* btnExit = wmgr.createWindow("TaharezLook/PushButton", "btnExit");


But it fails so I assume you do it a different way? Can you point me to any tutorials or anything that would help me instantiate widgets and use them?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Unhandled execption on System::create()

Postby CrazyEddie » Mon Mar 15, 2010 09:56

Hmm. That code should work - I wonder what you mean by it fails? Perhaps you're not hooking it into an active window / root window?

One source of examples, is the CEGUI sample apps. Another place you can look is Widget Galore. Some parts of this are out-dated, but the window creation parts should still be current.

HTH

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 2 guests