Boost 序列化断言失败

发布于 2024-10-18 13:04:42 字数 833 浏览 5 评论 0原文

我使用boost的二进制序列化,到目前为止效果很好。我有 std::list 指针用于序列化输出(oarchive),但序列化在 MSVC 对话框的对象的 serialize() 函数内部失败:

R6010 -abort() 已被调用

并且这样的字符串被打印到控制台窗口中:

Assertion failed: 0 == static_cast(t) || 1 == static_cast(t),文件 c:\program files\boost\boost_1_44\boost\archive\basic_binary_oprimitive.hpp,第 91 行

是什么意思?

项目相当大,源代码是分布式的,所以我无法在这里发布它的代码,但我尝试在简单的项目中模拟这个错误 - 在那里它工作正常,但奇怪的是。

PS 我在 Windows XP 上使用 boost 1.44 和 MSVC2010EE。当我在“调试错误!”窗口中单击“重试”时,调试器会在序列化 archive next 代码行上显示箭头< myList; 行 - 我的意思是似乎在某些析构函数或其他地方发生了错误。 当我在对象serialize()函数内进行更改时 - 它们将在我重建整个项目时应用(编译前清理) - 但如果我只是编译它(其中IDE显示包含更改的标头的所有源都被重新编译) - 没有更改自上一个版本以来将在运行时发生(我尝试使用 printf()) - 这很奇怪。 我可以偶尔设置一些关键的定义什么的吗?

I use boost's binary serialization and it worked well until now. I have std::list of pointers to serialize for output (oarchive) but serialization fails inside object's serialize() function with MSVC's dialog:

R6010 -abort() has been called

and such string is printed into console window:

Assertion failed: 0 == static_cast<int>(t) || 1 == static_cast<int>(t), file c:\program files\boost\boost_1_44\boost\archive\basic_binary_oprimitive.hpp, line 91

what does it mean?

Project is pretty big, sources are distributed so I cannot post it's code here, but I tried to simulate this error within simple project - there it works fine what is strange.

P.S. I use boost 1.44 with MSVC2010EE on Windows XP. When I click "retry" on "Debug Error!" window debugger shows arrow on the code line next to serialization archive << myList; line - I mean it seems like error occurred at some destructor or something.
When I make changes inside objects serialize() function - they will be applied just when I rebuild whole project (clean before compiling) - but if I just compile it (where IDE shows that all sources which include changed header are recompiled) - no changes will happen at runtime since last version (I tried with printf()) - that's strange.
Could I occasionally set some critical definitions or something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戏剧牡丹亭 2024-10-25 13:04:42

有问题的行表示:

// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.

看起来在某个时候您正在尝试序列化尚未初始化的 bool 。如果没有进一步的代码,我们无法帮助您找到哪一个。

The line in question says:

// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.

It looks like at some point you are trying to serialize a bool that hasn't been initialized. Without further code we can't help you find which one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文