在Xp上用VC6.0调试程序,不知什么时候开始,就不能使用调试了,总提示一堆的错误,但是能正常运行,就连按提示直接建的对话框程序都不能使用调试,按调试建后就直接退出,特别奇怪,但是建立的纯C工程能进行调试.只要加了对话框就不行,有没有碰到过啊?帮忙解答下,我很是郁闷.以下是我按VC提示建的一个最简单的对话框程序按调试后显示的输出信息:(建完后我一个字没改,只是加了调试断点),我也试过把access violation异常的action改成了stop always,但是还是一样的
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\system32\MFC42D.DLL'
Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\system32\MFCO42D.DLL'
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\NTDLL32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comdlg32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winspool.drv', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oledlg.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\olepro32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\setupapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\WebPageParser.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\CharSet.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\CreateDomTree.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wininet.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\crypt32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msasn1.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wsock32.dll', no matching symbolic information found.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
The thread 0xCAC has exited with code 2147323904 (0x7FFD9000).
The program 'E:\code\vc_code\testdialog\Debug\testdialog.exe' has exited with code 2147323904 (0x7FFD9000).
)

解决方案 »

  1.   

    The   first-chance   exception   can   be   ignored   because   it   is   safely   handled   by   the   operating   system.     
      INFO:   First   and   Second   Chance   Exception   Handling   (Q105675)   
      Structured   exception   handling   (SEH)   takes   a   little   getting   used   to,   particularly   when   debugging.   It   is   common   practice   to   use   SEH   as   a   signaling   mechanism.   Some   application   programming   interfaces   (APIs)   register   an   exception   handler   in   anticipation   of   a   failure   condition   that   is   expected   to   occur   in   a   lower   layer.   When   the   exception   occurs,   the   handler   may   correct   or   ignore   the   condition   rather   than   allowing   a   failure   to   propagate   up   through   intervening   layers.   This   is   very   handy   in   complex   environments   such   as   networks   where   partial   failures   are   expected   and   it   is   not   desirable   to   fail   an   entire   operation   simply   because   one   of   several   optional   parts   failed.   In   this   case,   the   exception   can   be   handled   so   that   the   application   is   not   aware   that   an   exception   has   occurred.     
        
      However,   if   the   application   is   being   debugged,   it   is   important   to   realize   that   the   debugger   will   see   all   exceptions   before   the   program   does.   This   is   the   distinction   between   the   first   and   second   chance   exception.   The   debugger   gets   the   "first   chance,"   hence   the   name.   If   the   debugger   continues   the   exception   unhandled,   the   program   will   see   the   exception   as   usual.   If   the   program   does   not   handle   the   exception,   the   debugger   will   see   it   again   (the   "second   chance").   In   this   latter   case,   the   program   normally   would   have   crashed   had   the   debugger   not   been   present.     
        
      If   you   do   not   want   to   see   the   first   chance   exception   in   the   debugger,   then   disable   the   feature.   Otherwise,   during   execution,   when   the   debugger   gets   the   first   chance,   continue   the   exception   unhandled   and   allow   the   program   to   handle   the   exception   as   usual.   Check   the   documentation   for   the   debugger   that   you   are   using   for   descriptions   of   the   commands   to   be   used.
      

  2.   

    在VC中调试程序时,Output窗口有时会出现“First-chance exception in xxx.exe...”这样的信息。一般来说,这是由于程序中发生了异常,被VC捕获而产生的输出。在调试器中运行程序时,如果程序产生异常,调试器会首先获得通知(即First-chance exception),而后此异常由产生它的程序负责捕获。如果程序没有捕获此异常,那么调试器会再次被通知(即Second-chance exception,Last-chance exception),并结束程序。通常见到的“First-chance exception”一般是“0xC0000005: Access Violation”,“0xC00000FD: Stack Overflow”等,这些都说明程序中有缺陷,需要修正。但是也有一些属于正常的情况,例如“First-chance exception in xxx.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception”。Windows 操作系统中广泛使用了结构化异常(SEH)来处理特殊情况,许多和底层打交道的API都靠SEH来处理可能发生的意外。并且,这些API中都有捕获SEH的代码,产生的异常不会对程序造成影响。但是由于上面提到的“First-chance exception,Second-chance exception”机制,VC仍然会有输出,但是我们完全可以忽略。如果你实在不喜欢这些输出信息,那你就必须禁用对特定异常的“First-chance exception”捕获。
    网上搜的:)
      

  3.   

    First-chance exception in testdialog.exe: 0xC0000005: Access Violation.
    The thread 0xCAC has exited with code 2147323904 (0x7FFD9000).很明显内存访问出错,且导致了程序的崩溃,一个很严重的错误,不能忽略。
    建议楼主贴出相关的代码。