gpt4 book ai didi

C++ 程序仅在调试器中崩溃

转载 作者:行者123 更新时间:2023-11-28 08:16:42 26 4
gpt4 key购买 nike

我的申请有问题。每次我在调试器中启动它时,它都会在向 map 添加项目时崩溃。当我将它作为独立应用程序启动时,它可以正常工作。

删除并重新创建具有 map 的 Objekt,重新创建后调试器因错误而崩溃,整个 pc 被卡住。唯一的方法是硬重启。

有谁知道可能是什么问题?

P.s.: 这是相关的代码片段:

标题:

        /**
* List of propertyKey value
*/
typedef std::map<std::string, boost::any> Changes;
/**
* List of id changes
*/
typedef std::map<std::string, Changes> ChangesMap;
ChangesMap m_changeList;

方法主体:

void PushController::CollectAttributeChanges(
const std::string &id, const std::string &key, const boost::any &value)
{
(m_changeList[id])[key] = value;
}

最好的问候, Gerrit

最佳答案

您是否使用任何可以以某种方式影响 STL 二进制兼容性的标志构建您的应用程序(例如 _SECURE_SCL=0)并且以相同的方式构建 boost?

应用程序的另一部分是否会破坏堆?

您可以在整个代码中插入 _CrtCheckMemory() 调用,以便更接近发生堆损坏的时间来检测它们。

关于C++ 程序仅在调试器中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7514381/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com