Visual Studio 2008中出现未处理的异常

Unhandled exception in Visual Studio 2008

本文关键字:未处理 异常 Studio 2008 Visual      更新时间:2023-10-16

我用C++完成了程序的编写。我使用"cout"进行调试。一切都正常,我删除了调试注释,但运行程序时出现了问题。当我使用评论时,一切都很好。但当我删除它们时,程序启动,允许我写文件名,但当我按下"回车"时,错误发生了:

Pathfinder.exe中0x0142d866处未处理的异常:0xC0000005:读取位置0xcccccc70的访问冲突

xiosbase头文件打开,在上显示

fmtflags __CLR_OR_THIS_CALL flags() const
{   // return format flags
    return (_Fmtfl);
}

当我尝试在Map中放置元素时,会发生错误。只有在不同函数中删除调试注释时才会发生这种情况。有人能帮忙吗?

-this 0xcccccc6c {_Stdstr=??? _Mystate=??? _Except=??? ...} const std::ios_base * const
    std::_Iosb<int> {...}   std::_Iosb<int>
    __vfptr CXX0030: Error: expression cannot be evaluated  
    _Stdstr CXX0030: Error: expression cannot be evaluated  
    _Mystate CXX0030: Error: expression cannot be evaluated 
    _Except CXX0030: Error: expression cannot be evaluated  
    _Fmtfl  CXX0030: Error: expression cannot be evaluated  
    _Prec   CXX0030: Error: expression cannot be evaluated  
    _Wide   CXX0030: Error: expression cannot be evaluated  
    _Arr    CXX0017: Error: symbol "" not found 
    _Calls  CXX0017: Error: symbol "" not found 
    _Ploc   CXX0017: Error: symbol "" not found 
    _Index  0   int
    _Sync   true    bool

值0xcccccc70看起来像是程序使用了未初始化指针的偏移量。

在调试模式下,内存中会填充0xcccccccc,以使其更加可见。

通过分析代码进行故障排除将是一件非常痛苦的事情。其他人已经为你指出了一个很好的总体方向,但如果你没有看到一些明显的东西,比如一个未初始化的指针,那么这可能是某种内存损坏。

为程序启用完整的页面堆,然后再次在调试器中运行。如果不是在腐败的时候,它应该早点崩溃,这会给你更多的信息。