2011-10-22 4 views
1

Je voudrais utiliser PhysFS en conjonction avec Boost.Serialization. J'ai trouvé une implémentation here qui utilise Boost.Iostreams pour créer un flux de fichier PhysFS. Il travaille pour les opérations de base, acheter si je ti l'utiliser avec Boost.Serialization essayer, je reçois l'erreur suivante lors de l'exécution:Comment faire fonctionner Boost.Serialization avec PhysicsFS

/usr/include/boost/iostreams/detail/optional.hpp:55: T& boost::iostreams::detail::optional<T>::operator*() [with T = boost::iostreams::detail::concept_adapter<PhysFS::FileDevice>]: Assertion `initialized_' failed. 
Aborted 

est ici un exemple de code.

PhysFS::init(argv[0]); 
PhysFS::setWriteDir("."); 
PhysFS::FileStream ofs("test.xml", PhysFS::OM_WRITE); 
boost::archive::xml_oarchive xml(ofs); 
vec2 vec(3.1415, 2.5); 
xml << BOOST_SERIALIZATION_NVP(vec); 
ofs.close(); 
PhysFS::deinit(); 

Est-il possible d'obtenir un gestionnaire de flux de fichiers de travail pour PhysFS qui travaillera avec les bibliothèques comme Boost.Serialization?

Répondre

0

Mon erreur appelait ofs.close(), et appelait aussi PhysFS :: deinit avant la destruction de ofs.

Questions connexes