Re: [Boost-users] boost\serialization expects 2 arguments - 3 provided with VC71 /MDd
Robert, I really like the boost serialization library. However, I am having a similar compiler error with VC71. I am trying to use the following code for all STL collections. template void LoadFromXml(const std::string &sXmlText, TValue &oValue) { std::istringstream oInStream(sXmlText); assert(oInStream.good()); boost::archive::xml_iarchive oIn(oInStream); oIn >> BOOST_SERIALIZATION_NVP(oValue); // restore from XML archive. } When the VC71 uses Multi-threaded Debug DLL (/MDd) setting, it generates the following compiler error: C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\boost\serialization\split_free.hpp(55) : error C2780: 'void boost::archive::load(Archive &,T &)' : expects 2 arguments - 3 provided C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\boost\archive\detail\iserializer.hpp(514) : see declaration of 'boost::archive::load' C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\boost\serialization\split_free.hpp(54) : while compiling class- template member function 'void boost::serialization::free_loader::invoke(Archive &,T &,const unsigned int)' with [ Archive=boost::archive::xml_iarchive, T=std::vector ] C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\boost\serialization\split_free.hpp(70) : see reference to class template instantiation 'boost::serialization::free_loader' being compiled with [ Archive=boost::archive::xml_iarchive, T=std::vector ] C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\boost\serialization\vector.hpp(79) : see reference to function template instantiation 'void boost::serialization::split_free>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::xml_iarchive, _Ty=int, T=std::vector ] Changing the setting to Multi-threaded Debug (/MTd), everything works well. I could not figure out why. Could you please help me? Thanks Yang
After many hours of trying, finally found out that If my C++ file uses the free function to archive STL collections, the file must include the following line right after its "#include" section to correctly archive STL collections. using namespace std; Not sure exactly why, but not feel bad either. Now everything works great! Yang
participants (2)
-
G Yang
-
Guoxing Yang