Page 1 of 1

[SOLVED]DefaultResourceProvider mac compile error

Posted: Fri Feb 06, 2009 20:50
by nairboon
I can't use the DefaultResourceProvider: (as in the tutorial@wiki)

Code: Select all

 CEGUI::DefaultResourceProvider* rp =
            static_cast(CEGUI::System::getSingleton().getResourceProvider());

i get that error:

Code: Select all

error: expected `<' before ‘(’ token
error: expected type-specifier before ‘(’ token
error: expected `>' before ‘(’ token

i tried also casting like that:

Code: Select all

static_cast<CEGUI::DefaultResourceProvider*>(..)

I'm not using Ogre.
cegui, 0.6.2
gcc 4.2
mac 10.5

Any ideas?

Posted: Sat Feb 07, 2009 09:21
by CrazyEddie
Hi, and welcome :)

Firstly, I had a look and there is an error in the tutorial as regards to the way that cast is presented. Apologies for that mistake; I wonder how many other people have been caught by that - at least one, since they posted a while ago, but it didn't occur to me that the tutorial had the incorrect cast usage - what a tool I am :lol:

Anyway, thanks for that. And the correct usage should indeed be:

Code: Select all

CEGUI::DefaultResourceProvider* rp =
            static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());


However, you indicate that you've tried this, can you let us know the error you get in this case? Without the other error I can only guess at the cause, so at this stage I'll recommend you ensure you have included the required headers, which in this case is "CEGUIDefaultResourceProvider.h".

HTH

CE.

P.S. I'll fix the tutorial immediately after this session answering forum posts :)

[edit]
P.P.S. This is not a simple text fix - the article source is correct. It's actually an issue related to something else, I'll look into fixing it over this weekend, though it's a little more involved now; it also means that all other code on the Wiki will be affected by this, arrrgh! :evil:

Posted: Sat Feb 07, 2009 20:46
by nairboon
What a foolish mistake, I included CEGUIResourceProvider.h, but not CEGUIDefaultResourceProvider.h. Maybe you should add a smal notice about that to the wiki, otherwise there'll be more cegui-newbies with the same problem. But thanks for the help.
I've a lite feautre request, may you can add smt like that to CEGUIDefaultResourceProvider.cpp to avoid simple path mistakes, when forgetting the "/" at the end:

Code: Select all

if(final_filename[final_filename.length()-1] != '/')
final_filename += string("/");

Posted: Sun Feb 08, 2009 08:42
by CrazyEddie
nairboon wrote:What a foolish mistake, I included CEGUIResourceProvider.h, but not CEGUIDefaultResourceProvider.h. Maybe you should add a smal notice about that to the wiki, otherwise there'll be more cegui-newbies with the same problem. But thanks for the help.
I've a lite feautre request, may you can add smt like that to CEGUIDefaultResourceProvider.cpp to avoid simple path mistakes, when forgetting the "/" at the end:

Code: Select all

if(final_filename[final_filename.length()-1] != '/')
final_filename += string("/");


Yeah, I'll definitely get this done.

Posted: Sun Feb 08, 2009 20:07
by CrazyEddie
Just a quick update...

I have fixed the issue that caused certain code constructs to be incorrectly stripped from the output on the wiki.

I have added a note in the resource setup tutorial about including the correct header ;)

I'll add the check for the trailing path separator in v0-6 branch sometime over this coming week.

CE.