2012-08-29 23 views
0

我遇到了存儲RapidXML數據類型成員變量的問題。我也遇到了成員函數返回類型的這個問題。將類成員存儲爲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 

我試圖尋找此問題相關的任何東西,也沒有發現什麼。所以,任何幫助真的很感激。

回答

0

它看起來像一個命名空間問題。添加using namespace rapid_xml或用rapid_xml::xml_node替換xml_node

+0

看來我確實有一個命名空間問題!我有一個嚴格意義上的常用頭文件,並把它放在那裏,認爲它可以工作。但是,一旦我將RapidXML包含到類頭中,它就可以正常工作。謝謝。 – hrr4