C++ 将类成员存储为RapidXML数据类型
我在存储RapidXML数据类型的成员变量时遇到问题。我在成员函数的返回类型方面也遇到了这个问题 只有在类的文件头中我才会遇到这个问题。在函数中使用这些数据类型不会产生任何问题C++ 将类成员存储为RapidXML数据类型,c++,rapidxml,C++,Rapidxml,我在存储RapidXML数据类型的成员变量时遇到问题。我在成员函数的返回类型方面也遇到了这个问题 只有在类的文件头中我才会遇到这个问题。在函数中使用这些数据类型不会产生任何问题 class Level { public: //Level(); //~Level(); sf::Sprite Update(Camera& _currentView); char* ReadFile(std::string& _level); xml_node&l
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;
};
类级别
{
公众:
//水平();
//~Level();
精灵更新(摄像头和当前视图);
char*ReadFile(标准::字符串和\u级);
xml_节点*解析文件(std::string _级别,std::string _tileset);
void BuildLayers(xml\u node*\u fileNode);
void BuildClips();
无效位置();
私人:
int tileWidth,tileHeight;
整数totalWidth,totalHeight;
std::字符串tilesetSource;
sf::纹理瓷砖纹理;
int tileSeimageWidth,tileSeimageHeight;
//int tilesetWidth,tilesetHeight;
std::向量tiles向量;
//std::向量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
错误C2143:语法错误:缺少“;”在“之前,它看起来像是一个名称空间问题。使用命名空间rapid_xml添加,或者用rapid_xml::xml_node
替换xml_node
似乎我确实有命名空间问题!我有一个头文件,这是严格为共同包括,并把它放在那里认为它的工作。但是,一旦我将RapidXML include移到类标题中,它就工作得很好。谢谢