将类成员存储为RapidXML数据类型

Storing class members as RapidXML data types

本文关键字:RapidXML 数据类型 存储 成员      更新时间:2023-10-16

我在存储RapidXML数据类型的成员变量时遇到问题。我在成员函数的返回类型方面也遇到了这个问题。

只有在类的文件头中我才遇到这个问题。在函数中使用这些数据类型不会产生任何问题。

class Level
{
public:
    //Level();
    //~Level();
    sf::Sprite Update(Camera& _currentView);
    char* ReadFile(std::string& _level);
    xml_node<>* ParseFile(std::string _level, std::string _tileset);
    void BuildLayers(xml_node<>* _fileNode);
    void BuildClips();
    void BuildPositions();
private:
    int tileWidth, tileHeight;
    int totalWidth, totalHeight;
    std::string tilesetSource;
    sf::Texture tilesetTexture;
    int tilesetImageWidth, tilesetImageHeight;
    //int tilesetWidth, tilesetHeight;
    std::vector<std::vector<Tile*>> tilesVector;
    //std::vector<Tile*> tileVector;
};

这让我产生了这样的错误:

error C2143: syntax error : missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2238: unexpected token(s) preceding ';' enter code here

我已经尝试搜索与此问题相关的任何内容,但没有找到任何内容。因此,我们非常感谢您的帮助。

这看起来像是一个命名空间问题。添加using namespace rapid_xml或将xml_node替换为rapid_xml::xml_node