错误:在';'标记CEGUI之前的预期构造函数,析构函数或类型转换

时间:2014-04-11 05:44:32

标签: c++ cegui

我是新来的,至少发帖是因为我看过几篇有帮助我的帖子。现在我想看看有人可以帮忙解决这个问题:

#ifndef CPFSTATIC_H_
#define CPFSTATIC_H_

#include <CEGUI/CEGUI.h>
#include <CEGUI/CEGUIWindowRendererModule.h>
#include "CPFStaticProperties.h"

namespace CEGUI{
    /*!
     * \brief
     *      Based in FalagardStatic class.
     *
     *      This class requires LookNFeel to be assigned. The LookNFeel should     provide the following:
     *      States:
     *          - Enabled                     - basic rendering for enabled state.
     *          - Disabled                    - basic rendering for disabled state.
     *          - EnabledFrame                - frame rendering for enabled state
     *          - DisabledFrame               - frame rendering for disabled state.
     *          - WithFrameEnabledBackground  - backdrop rendering for enabled state with frame enabled.
     *          - WithFrameDisabledBackground - backdrop rendering for disabled state with frame enabled.
     *          - NoFrameEnabledBackground    - backdrop rendering for enabled state with frame disabled.
     *          - NoFrameDisabledBackground   - backdrop rendering for disabled state with frame disabled.
     */
class CPFStatic : public WindowRenderer
{
public:
    static const utf8   TypeName[];

    CPFStatic(const String &type);
    virtual ~CPFStatic();

    bool    isFrameEnabled() const { return d_frameEnabled; }
    bool    isBackgroundEnabled() const { return d_backgroundEnabled; }
    void    setFrameEnabled(bool setting);
    void    setBackgroundEnabled(bool setting);

    virtual void render();

protected:
    // static properties
    static CPFStaticProperties::FrameEnabled        d_frameEnabledProperty;
    static CPFStaticProperties::BackgroundEnabled   d_backgroundEnabledProperty;

    // implementation data
    bool    d_frameEnabled;
    bool    d_backgroundEnabled;
};
//CEGUI_DEFINE_WR_FACTORY(CPFStatic)
CEGUI::WindowRendererManager::addFactory<TplWindowRendererFactory<CPFStatic> >();
}

#endif /* CPFSTATIC_H_ */

我正在进行debian测试,我遇到的问题是编译时我得到了

CPFStatic.h:69:82: error: expected constructor, destructor, or type conversion before ‘;’ token

我只是不明白。对于我所看到的应该是有效的。我将不胜感激任何帮助。

1 个答案:

答案 0 :(得分:3)

这行代码试图调用WindowRendererManager的静态成员函数。

CEGUI::WindowRendererManager::addFactory<TplWindowRendererFactory<CPFStatic> >();

但是,此函数调用的当前位置不是要调用的有效位置。您应该将函数调用添加到在程序初始化期间运行的方法中(因此工厂在执行期间可用)。这可能是应用程序中main()或其他方法的开头。