C++ VC++ 中的异常错误 c0000005

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17168982/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 20:58:14  来源:igfitidea点击:

Exception Error c0000005 in VC++

c++visual-c++exceptioncrashaccess-violation

提问by user1465461

Am working on VC++ Console Application.

我正在开发 VC++ 控制台应用程序。

This application sends a file from Appdata\Roaming folder for a period of time.

此应用程序从 Appdata\Roaming 文件夹发送一个文件一段时间。

What happens is am getting this Crash error :

发生的事情是我收到此崩溃错误:

Problem signature:
Problem Event Name: APPCRASH
Application Name:   App.exe
Application Version:    1.0.0.2
Application Timestamp:  51c02fa8
Fault Module Name:  PCMeter.exe
Fault Module Version:   1.0.0.2
Fault Module Timestamp: 51c02fa8
Exception Code: c0000005
Exception Offset:   000069eb
OS Version: 6.1.7601.2.1.0.256.48
Locale ID:  1033
Additional Information 1:   0a9e
Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
Additional Information 3:   0a9e
Additional Information 4:   0a9e372d3b4ad19135b953a78882e789

Could anyone please help me to resolve this issue

谁能帮我解决这个问题

回答by David Heffernan

Exception code c0000005is the code for an access violation. That means that your program is accessing (either reading or writing) a memory address to which it does not have rights. Most commonly this is caused by:

异常代码c0000005是访问冲突的代码。这意味着您的程序正在访问(读取或写入)它无权访问的内存地址。最常见的原因是:

  • Accessing a stale pointer. That is accessing memory that has already been deallocated. Note that such stale pointer accesses do not always result in access violations. Only if the memory manager has returned the memory to the system do you get an access violation.
  • Reading off the end of an array. This is when you have an array of length Nand you access elements with index >=N.
  • 访问过时的指针。那就是访问已经释放的内存。请注意,这种陈旧的指针访问并不总是会导致访问冲突。只有当内存管理器将内存返回给系统时,您才会遇到访问冲突。
  • 读取数组的末尾。这是当您有一个长度数组N并使用 index 访问元素时>=N

To solve the problem you'll need to do some debugging. If you are not in a position to get the fault to occur under your debugger on your development machine you should get a crash dump file and load it into your debugger. This will allow you to see where in the code the problem occurred and hopefully lead you to the solution. You'll need to have the debugging symbols associated with the executable in order to see meaningful stack traces.

要解决此问题,您需要进行一些调试。如果您无法在开发机器上的调试器下发现故障,您应该获得崩溃转储文件并将其加载到您的调试器中。这将允许您查看问题发生在代码中的哪个位置,并有望引导您找到解决方案。您需要具有与可执行文件关联的调试符号才能查看有意义的堆栈跟踪。