Problems with the GameState

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
darkmaster
Halfling
Posts: 67
Joined: Wed Mar 09, 2005 7:04 pm
Location: Netherland

Problems with the GameState

Post by darkmaster »

hELLO all,

I implement the game state method which is shown in the wiki articles.
But when I try to run it, I got some erors which are very weird to me. Its happening when I try to use the CEGUI things in my apps.

C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(105) : error C2143: syntax error : missing ';' before '.'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(105) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(105) : error C2720: 'sMemManager' : '__declspec(dllimport ) ' storage-class specifier illegal on members
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(105) : error C2491: '`global namespace'::Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(105) : error C2059: syntax error : '.'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(106) : error C2143: syntax error : missing ';' before '.'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(106) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(106) : error C2720: 'sMemManager' : '__declspec(dllimport ) ' storage-class specifier illegal on members
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(106) : error C2182: 'sMemManager' : illegal use of type 'void'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(106) : error C2491: '`global namespace'::Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(106) : error C2059: syntax error : '.'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(107) : error C2143: syntax error : missing ';' before '.'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(107) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(107) : error C2720: 'sMemManager' : '__declspec(dllimport ) ' storage-class specifier illegal on members
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(107) : error C2491: '`global namespace'::Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(107) : error C2059: syntax error : '.'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(108) : error C2143: syntax error : missing ';' before '.'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(108) : warning C4229: anachronism used : modifiers on data are ignored
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(108) : error C2720: 'sMemManager' : '__declspec(dllimport ) ' storage-class specifier illegal on members
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(108) : error C2491: '`global namespace'::Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\malloc.h(108) : error C2059: syntax error : '.'

SOry to post all of this eror line, I really don't know the cause of this eror.

The program structure is looks like this

I have two header file:

GameEngine.h: it contains the class structure of GameManager, InPUTmANAGER, GameState

GameState.h: This is where my first state is made, SplashScreen state is the one causing problem. If I remove this, all the eror is gone.

two cpp file:
main.cpp:main call
GameEngine.cpp:the code for the GameEngine.h

I really dont understand what's wrong, hope anyone can suggest some solutions


Regards,


Dark
Engineers aren't boring people, but they got excited over boring things and they make it fun.
www.freewebs.com/gpkfontys
User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

There is a conflict with the xerces memory manager and the ogre memory manager, simply wrap all of your cegui includes with #define OGRE_NO_MEMORY_MACROS and after #define OGRE_MEMORY_MACROS

(I think)
phear hingo

My Webpage
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

almost ;)

Code: Select all

#include <OgreNoMemoryMacros.h>
// XERCES/CEGUI headers
#include <OgreMemoryMacros.h>
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
darkmaster
Halfling
Posts: 67
Joined: Wed Mar 09, 2005 7:04 pm
Location: Netherland

Post by darkmaster »

:D Niceee solution. Its working correctly now guys.

but why do we need to include<OgreNoMemoryMacros>
and include<OgreMemoryMacros>.

HOw is the workaround regarding to the memoryManager conflict be done with this statement? maybe someone can explain to me :wink:


Dark
Engineers aren't boring people, but they got excited over boring things and they make it fun.
www.freewebs.com/gpkfontys
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

Haven't looked into this, but I guess it has something to deal with #undef and #define preprocessor statements and things like that ;)
Image
User avatar
bal
Greenskin
Posts: 100
Joined: Thu Dec 09, 2004 7:29 pm
Location: Geluwe, Belgium

Post by bal »

Ogre's memory manager conflicts with Xerces' one.
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

I generally see Ogre's memory manager as a pita and disable it completely even in debug mode; although it's very nice if you want to detect leaks, it redefining the allocation/deallocation functions doesn't go to well with most if third party dependency, even Xerces and CEGUI.
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

Nice observation. Now that you mention it, I think I'll enable it only for the debug build ;)
Image
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

It is only enabled for debug builds by default.. :-)
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

That was Kencho's point. ;)
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

LOL You're right! :lol: I've won the "stupid comment of the month" prize, hahahaha!!!
Image
Post Reply