2017-03-27 8 views
1

構造体とクラスが設計したもので、究極的な目的はブーストシリアル化を使用してxmlに値を書き出すことです コードをコンパイルすると私はコンパイル時のエラーを取得するの下に(エラーが巨大であり、私はちょうどそれの最後の行を貼り付けている問題については、おそらく会談)構造体がシリアライズされていても、構造体には 'serialize'という名前のメンバーはありません。

/boost_1_49_0/include/boost/serialization/access.hpp:118: error: 'class std::map, std::allocator >, std::map, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > >, std::less, std::allocator > >, std::allocator, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > > > > >, std::less, std::allocator > >, std::allocator, std::allocator >, std::map, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > >, std::less, std::allocator > >, std::allocator, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > > > > > > > >' has no member named 'serialize' make: *** [READER.exe] Error 1

実際にメンバーのシリアル化を持っていますが、エラーがそれに反する以下AssetReaderInfoのclkass。私はそれはあなたが何が悪かったのかをお勧めしてくださいだろう混乱

に追加考えて

私は、メインのCPPコードをspecfied haventは、私はすべてのクラスでシリアル化を定義しているが、そのも をコンパイルに失敗しますか?

struct IdInfo 
{ 
    std::string m_milePost; 
    std::string m_cellModemAlertExclusionList; 

    public: 
    IdInfo():m_milePost("milepost"),m_cellModemAlertExclusionList("dummyval"){}; 

    template<class archive> 
    void serialize(archive& ar, const unsigned int version) 
    { 
     using boost::serialization::make_nvp; 
     ar & make_nvp("values", m_milePost); 
     ar & make_nvp("values", m_cellModemAlertExclusionList); 
    } 
}; 

class myReader { 
public: 

    friend class boost::serialization::access; 
    // Asset ID list 
    typedef std::map< std::string,IdInfo > myMap; 
    typedef std::map<std::string> mySet; 
    struct ReaderInfo 
    { 
     mySet m_aSList; 
     myMap m_pList; 
     myMap m_eList; 
     // WIU/BS type 
     std::string m_Type; 
     std::string m_topic; 
     std::string m_lastSavedMsg; 
     template <class archive> 
     void serialize(archive& ar, const unsigned int version) 
     { 
      using boost::serialization::make_nvp; 
      ar & make_nvp("values", m_topic); 
      ar & make_nvp("values", m_Type); 
      ar & make_nvp("values", m_eList); 
      ar & make_nvp("values", m_pList); 
     } 

    }; 
    typedef std::map< std::string, ReaderInfo > GroupDataMap; 
    GroupDataMap m_GroupDataMap; 

    template<class archive> 
    void serialize(archive& ar, const unsigned int version) 
    { 
     using boost::serialization::make_nvp; 
     ar & make_nvp("Group", m_GroupDataMap); 
    } 
} 

int main() 
{ 
    myReader Reader; 
    boost::archive::xml_oarchive xml(ofs); 
    xml << boost::serialization::make_nvp("Connections", Reader); 
} 

ソリューション:ヘルプ

+0

削除または自己回答のいずれかです。このようにして、問題はもはや注意を必要としていないことは明らかです – sehe

答えて

0

それは私がSTDを使用してIAMとして/boost/serialization/map.hppを含むべきであることが判明したため

It turns out that i should include /boost/serialization/map.hpp as iam using a std::map

おかげ::マップ

#include /boost/serialization/map.hpp

関連する問題