0
我們正在使用boost :: serialization測試一個非常簡單的序列化代碼。測試只是在文件中寫入一個std :: string。使用windows中的字符串提升序列化運行時錯誤
它編譯好,但問題是,當調用< <運算符時它會拋出一個異常。該文件保持空白。
未處理的異常在test.exe的0x1004b370(msvcr100d.dll)0x000000000021647a:0000005:訪問衝突0x000000000021647a
我們使用的是帶有VISUALC++ 2010在Windows 7 64位編譯提升1.53庫。也嘗試與英特爾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();
}
任何幫助?
編譯參數? – didierc
boost已從下載的文件夾中按以下行編譯:bjam.exe variant = debug link = shared threading = multi runtime-link = shared --stagedir =。/ --build-type = complete --with-serialization address-model = 64 – auroras
當使用'stringstream'而不是'ofstream'時,你會遇到同樣的崩潰嗎? –