0

我距离编译 Qgears 有 2 个错误。(最终幻想 VII 引擎的破解版)

我弄乱了预处理器来加载食人魔头文件的实际位置。

以下是错误:

||=== 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 ===|

这是头文件:

// $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

include 中唯一不是 Ogre 头文件的头文件是“map”。

如果有帮助,我在 GNU/Linux 中使用 Code::Blocks IDE/GCC 编译器。(拱)

我不确定即使我修复了这个标题,我想我以后也会有构建错误,但值得一试。

编辑:我添加了分号,头文件中还有一个错误:

error: expected unqualified-id before ‘{’ token
4

1 回答 1

0

TextBlock结构定义最后错过了 a ;

此外,std::vector并且std::list在没有适当的. 的情况下使用#include。如果它们尚未包含在某些标头中,则也可能导致构建错误。

编辑:以下与 VC 和 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;

你用你的编译器编译这个有问题吗?

于 2010-03-01T09:00:03.573 回答