Visual Studio 2008中未处理的异常

问题描述

| 我用C ++编写了程序。我使用\'cout \'进行调试。一切正常,我删除了调试注释,但是运行程序有问题。当我使用评论时,一切正常。但是,当我删除它们时,程序会启动,允许我写文件名,但是当我按下\'enter \'时,会发生错误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,以使其更明显。     ,        通过分析代码进行故障排除将是真正的痛苦。其他人为您指出了一个良好的总体方向,但是如果您没有看到诸如未初始化的指针之类的明显信息,则可能是某种内存损坏。 为程序启用完整的pageheap,然后在调试器中再次运行。如果没有出现损坏,它应该更早崩溃,这将为您提供更多信息。