2017-03-27 5 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

그것은 내가이 표준을 사용하여 스피로 /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