Updated to latest CVS, bad move?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Xothin
Just popping in
Just popping in
Posts: 17
Joined: Wed Jan 12, 2005 12:06

Updated to latest CVS, bad move?

Postby Xothin » Sun Dec 12, 2004 06:34

Getting some nasty compile errors when I updated to the latest CVS.

They all revolve around the Ogre Memory manager. I'll post my errors, and then my code.

Code: Select all

c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(113) : warning C4002: too many actual parameters for macro 'calloc'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(113) : error C2143: syntax error : missing ';' before '.'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(113) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(113) : error C2720: 'Ogre::MemoryManager::sMemManager' : 'Ogre::MemoryManager::' storage-class specifier illegal on members
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(113) : error C2491: 'Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(114) : error C2143: syntax error : missing ';' before '.'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(114) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(114) : error C2720: 'Ogre::MemoryManager::sMemManager' : 'Ogre::MemoryManager::' storage-class specifier illegal on members
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(114) : error C2182: 'sMemManager' : illegal use of type 'void'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(114) : error C2491: 'Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(115) : error C2143: syntax error : missing ';' before '.'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(115) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(115) : error C2720: 'Ogre::MemoryManager::sMemManager' : 'Ogre::MemoryManager::' storage-class specifier illegal on members
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(115) : error C2491: 'Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(116) : error C2143: syntax error : missing ';' before '.'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(116) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(116) : error C2720: 'Ogre::MemoryManager::sMemManager' : 'Ogre::MemoryManager::' storage-class specifier illegal on members
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\malloc.h(116) : error C2491: 'Ogre::MemoryManager::sMemManager' : definition of dllimport static data member not allowed
c:\OgreProjects\cegui_mk2\dependencies\include\xercesc\util\XMemory.hpp(94) : error C2544: expected ')' for operator '()'
c:\OgreProjects\cegui_mk2\dependencies\include\xercesc\util\XMemory.hpp(94) : error C2143: syntax error : missing ';' before 'Ogre::MemoryManager::sMemManager'
c:\OgreProjects\cegui_mk2\dependencies\include\xercesc\util\XMemory.hpp(94) : fatal error C1903: unable to recover from previous error(s); stopping compilation


guimanager.h

Code: Select all

#if OGRE_PLATFORM == PLATFORM_WIN32
#pragma once
#endif
 
#ifndef guimanager_h
#define guimanager_h

// for Ogre Functionality
#include "Ogre.h"
// for Crazy Eddys GUI system
#include "CEGui.h"
#include "renderers/OgreGUIRenderer/ogrerenderer.h"
// #include "client/base/kernel.h"
// #include "client/client.h"
#include "boost/bind.hpp"

// this struct is for loading values from an ini/XML file to restore a user layout
struct WinValues
{
   char* name;
   float height;
   float length;
   float xPosition;
   float yPosition;
   char* font;
   char* skin;
   char* mousePointer;
   bool sizingEnabled;
   bool textDisplayed;
   bool dragMovingEnabled;
};

using namespace Ogre;
using namespace CEGUI;

class atGUIManager
{
private:
   // overridable methods if the child class has a better implimentation
   virtual void LoadScheme();
    virtual void ClearAll();
   // Most guis will have a way to exit the game, parent should handle this
   void CleanUp();
   void ExitPressed();

protected:
   OgreRenderer* atOgreRenderer;
   // For calling essential Ogre::Root functions, stores a pointer.
   Root* m_Root;
   // flag for signalling readiness for destruction.
   bool m_ReadyForCleanUp;
   // Console window item.
   Window* m_ConsoleWindow;

public:
   atGUIManager();
   ~atGUIManager();
   Root* GetRoot();
   OgreRenderer* getRenderer();   
   // For creating a console screen, ie for debugging input, commands to the server.
   void createConsoleWindow();
   // Initialization method, this HAS to occur
   void initialise(RenderWindow* ogreWindow, Root* ogreRoot);
   void setCleanUpReady(bool readyForCleanUp);

};

#endif


guimanager.cpp

Code: Select all

#include "guimanager.h"

atGUIManager::atGUIManager()
{
}

atGUIManager::~atGUIManager()
{
    CleanUp();
   // TODO: Add cleanup methods
}

// Base initialization of the graphical frontend
// Takes the Renderwindow as a pointer for an argument.
void atGUIManager::initialise(RenderWindow* ogreWindow, Root* ogreRoot)
{
   try
   {
       // Store the Root variable for use later
       m_Root = ogreRoot;
        // Set the rendering options
        atOgreRenderer = new OgreRenderer(ogreWindow, RENDER_QUEUE_OVERLAY, false, 3000);
        // Create the GUI system
        new System(atOgreRenderer);
         // Start the CEGUI logger
        Logger::getSingleton().setLoggingLevel(Informative);

       Window* sheet = WindowManager::getSingleton().createWindow((utf8*)"DefaultWindow", (utf8*)"mainWnd");
       System::getSingleton().setGUISheet(sheet);

        // TODO: Add GUI initialization
   }
   catch(CEGUI::Exception)
   {

   }
}

// Clears screen, readies client for new widgets
void atGUIManager::ClearAll()
{
   //TODO: Add cleanup routines
}

// Since almost all GUIs are going to have some type of exit button, lets go ahead and make the parent
// perform the queueEndRendering() function to get everything underway.
void atGUIManager::ExitPressed()
{
   m_Root->queueEndRendering();
}

Root* atGUIManager::GetRoot()
{
   return m_Root;
}

// To let the cleanup system know that this is ready to be cleaned up and destructed.
void atGUIManager::setCleanUpReady(bool readyForCleanUp)
{
   m_ReadyForCleanUp = readyForCleanUp;
}

// Loads the scheme from a .scheme file for CEGUI
void atGUIManager::LoadScheme()
{
   // Lets load our scheme from a file
   CEGUI::SchemeManager::getSingleton().loadScheme((utf8*)"../datafiles/schemes/WindowsLook.scheme");
   // Load our mouse cursor
   System::getSingleton().setDefaultMouseCursor((utf8*)"WindowsLook", (utf8*)"MouseArrow");
   // Load the font
   System::getSingleton().setDefaultFont((utf8*)"Tahoma-12");
}

void atGUIManager::CleanUp()
{
   delete CEGUI::System::getSingletonPtr();
   if(atOgreRenderer)
   {
      delete atOgreRenderer;
      atOgreRenderer = NULL;
   }
}

// This is implimented here so that any of our child classes can impliment this function.
// To create the childwindow just do childClassImplimentation->createConsoleWindow();
void atGUIManager::createConsoleWindow()
{
   WindowManager& winMgr = WindowManager::getSingleton();
   
   m_ConsoleWindow = winMgr.getWindow((utf8*)"mainWnd");

   FrameWindow* frameConsole = (FrameWindow*)winMgr.createWindow((utf8*)"TaharezLook/FrameWindow", (utf8*)"FrameConsole");
   m_ConsoleWindow->addChildWindow(frameConsole);
   frameConsole->setPosition(Point(0.064141f, 0.329530f));
   frameConsole->setSize(Size(1.0, 0.321091f));
   frameConsole->setDragMovingEnabled(true);
   frameConsole->setSizingEnabled(true);
   frameConsole->setTitleBarEnabled(true);
   frameConsole->setCloseButtonEnabled(true);
   frameConsole->setAlwaysOnTop(false);
   frameConsole->setText((utf8*)"Console");

   Listbox* consoleText = (Listbox*)winMgr.createWindow((utf8*)"TaharezLook/Listbox", (utf8*)"ConsoleText");
   frameConsole->addChildWindow(consoleText);
   consoleText->setPosition(Point(0.0, 0.0));
   consoleText->setSize(Size(1.0, 0.8));
   
   Editbox* consoleEditLine = (Editbox*)winMgr.createWindow((utf8*)"TaharezLook/Editbox", (utf8*)"ConsoleEditLine");
   frameConsole->addChildWindow(consoleEditLine);
   consoleEditLine->setPosition(Point(0.0, .81));
   consoleEditLine->setSize(Size(0.8, .19));
   
   PushButton* consoleEnter = (PushButton*)winMgr.createWindow((utf8*)"TaharezLook/Button", (utf8*)"ConsoleEnter");
   frameConsole->addChildWindow(consoleEnter);
   consoleEnter->setPosition(Point(.81, .81));
   consoleEnter->setSize(Size(0.2, .19));
   consoleEnter->setText((utf8*)"Enter");

   frameConsole->setEnabled(false);
   frameConsole->setVisible(false);

}

OgreRenderer* atGUIManager::getRenderer()
{
   return atOgreRenderer;
}


This code compiled great before I updated today... after that, I can't get it to compile again.

Any suggestions CE?

I'm not sure if I am supposed to initialize a resource provider in here, I didn't see anything on the forums regarding this, but I'll wait and see if you've got some better info for me. ^.^

Edit:

Ok, this gets stranger and stranger...

I commented out just about EVERY line in the project, and I still get these build errors. This is only compiling a single file. guimanager.cpp.

Funny thing is, I put the exact same code into another project... compiles without issues. I didn't do a copy paste, I hand typed in a few portions of it. But it's even failing with everything commented out. 8O

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

Updated to latest CVS, bad move?

Postby CrazyEddie » Sun Dec 12, 2004 10:47

Include CEGUI.h before Ogre.h; this eliminates a clash between the Xerces-C++ memory manager and the Ogre memory manager - which is what is causing the problem :)

CE.

User avatar
Xothin
Just popping in
Just popping in
Posts: 17
Joined: Wed Jan 12, 2005 12:06

Updated to latest CVS, bad move?

Postby Xothin » Sun Dec 12, 2004 11:29

8O 8O 8O 8O

OMG!

Funny thing is... that was the difference between the project that compiled, and the one that didn't..

User avatar
Spoke
Quite a regular
Quite a regular
Posts: 48
Joined: Wed Jan 12, 2005 12:06
Location: Spain
Contact:

Updated to latest CVS, bad move?

Postby Spoke » Sun Dec 12, 2004 22:25

That´s why I wanted to remove client dependecie on xeces. :wink:

I fix this by placing

Code: Select all

#include <OgreNoMemoryMacros.h>


prior to any CEGUI related include and

Code: Select all

#include <OgreMemoryMacros.h>


after the CEGUI includes.

Hope it helps.
May the Force be with you!


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 9 guests