在Windows中使用字符串提升序列化运行时错误

时间:2013-04-17 15:22:05

标签: c++ visual-studio-2010 visual-c++ boost boost-serialization

我们正在使用boost :: serialization测试一个非常简单的序列化代码。测试只是将std :: string写入文件中。

它编译好但问题是它在<<<<<<<<<<运算符被调用。该文件仍为空。

0x1004b370中未处理的异常(msvcr100d.dll)test.exe中的0x000000000021647a:0xC0000005:0x000000000021647a中的访问冲突

我们正在使用在Windows 7 64位中使用visualc ++ 2010编译的boost 1.53库。还尝试使用Intel 12.1 64位但没有成功。

#include <fstream> 
#include <boost/serialization/string.hpp>
#include <boost/archive/text_oarchive.hpp> 

int main(int argc, char * argv[])
{
    std::string s = "HelloWorld!"; 

    std::ofstream file("archive.txt"); 
    boost::archive::text_oarchive oa(file); 

    oa << s;

    file.close();
}

任何帮助?

1 个答案:

答案 0 :(得分:0)

我们发现问题与我们在项目中使用的预处理指令_HAS_ITERATOR_DEBUGGING = 0有关。使用时,fstream不能很好地工作。有什么想法吗?这是fstream中的一个错误(不太可能)?感谢