English 中文(简体)
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 before ‘{’ 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?





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签