开发者

I need help with this ogre dependent header (Qgears)

I'm 2 errors away from compiling Qgears. (Hacked Version of the Final Fantasy VII Engine)

I've messed with the preprocessors to load the actual location of the ogre header files.

Here are the errors:

||=== qgears, Debug ===|
/home/cj/Desktop/qgears/trunk/project/linux/src/core/TextManager.h|48|error: invalid use of ‘::’|
/home/cj/Desktop/qgears/trunk/project/linux/src/core/TextManager.h|48|error: expected ‘;’ before ‘m_LanguageRoot’|
||=== Build finished: 2 errors, 0 warnings ===|

Here's the header file:

// $Id$

#ifndef TEXT_MANAGER_h
#define TEXT_MANAGER_h

#include <OGRE/OgreString.h>
#include <OGRE/OgreUTFString.h>
#include <map>

struct TextData
{
    TextData():
        text(""),
        width(0),
        height(0)
    {
    }

    Ogre::String        name;
    Ogre::UTFString     text;
    int                 width;
    int                 height;
};

typedef std::vector<TextData> TextDataVector;



class TextManager
{
public:
                          TextManager(void);
    virtual              ~TextManager(void);

    void                  SetLanguageRoot(const Ogre::String& root);

    void                  LoadTexts(const Ogre::String& file_name);
    void                  UnloadTexts(const Ogre::String& file_name);
    const TextData        GetText(const Ogre::String& name);

private:
    struct TextBlock
    {
        Ogre::String          block_name;
        std::vector<TextData> text;
    }

    Ogre::String            m_LanguageRoot;    // Line #48
    std::list<TextBlock>    m_Texts;
};



extern TextManager* g_TextManager;



#endif // TEXT_MANAGER_h

The only header file that's in include that's not a ogre header file is "map".

If it helps, I'm using the Code::Blocks IDE/GCC Compiler in GNU/Linux. (Arch)

I'm not sure even if I get this header fixed, I think I'll have build errors latter, but it's worth a shot.

Edit: I added the semicolon and I have one more error in the header file:

error: expected unqualified-id befor开发者_如何学编程e ‘{’ token


That TextBlock struct definition misses a ; at the end.

Also, std::vector and std::list are used without the appropriate #include. If they aren't included already in some header, that might cause build errors, too.

Edit: The following compiles with both VC and Comeau:

//#include <OGRE/OgreString.h>
//#include <OGRE/OgreUTFString.h>
namespace Ogre {
    struct String { String() {} String(const char*) {} };
    struct UTFString { UTFString() {} UTFString(const char*) {} };
}

#include <map>
#include <vector>
#include <list>

struct TextData
{
    TextData():
        text(""),
        width(0),
        height(0)
    {
    }

    Ogre::String        name;
    Ogre::UTFString     text;
    int                 width;
    int                 height;
};

typedef std::vector<TextData> TextDataVector;



class TextManager
{
public:
                          TextManager(void);
    virtual              ~TextManager(void);

    void                  SetLanguageRoot(const Ogre::String& root);

    void                  LoadTexts(const Ogre::String& file_name);
    void                  UnloadTexts(const Ogre::String& file_name);
    const TextData        GetText(const Ogre::String& name);

private:
    struct TextBlock
    {
        Ogre::String          block_name;
        std::vector<TextData> text;
    };

    Ogre::String            m_LanguageRoot;
    std::list<TextBlock>    m_Texts;
};

extern TextManager* g_TextManager;

Do you have trouble compiling this with your compiler?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜