visual studio 2008解决方案发布版本运行时致命错误 [英] visual studio 2008 solution release version runtime fatal error

查看:249
本文介绍了visual studio 2008解决方案发布版本运行时致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Visual Studio 2008解决方案,包括一些项目,并使用dll与他们的头。在调试版本(解决方案)工作真的很好。在发布版本中,它编译成功,但是在执行一些在dll文件中定义的函数会失败。

I have a Visual Studio 2008 solution which consists of some projects and uses dll's with theirs' headers. In the debug version it (the solution) works really well. And in release version it compiles successfully, but on executing some functions which are defined in a dll file it fails.

正如我所说,解决方案在调试模式下工作正常,和选项设置正确。试图关闭

优化,打开调试信息,它没有帮助。这是什么原因的问题?

As I said, the solution works fine in debug mode, and options set properly. Tried turning off
optimization, turned on debugging information, it didn't help. What can be the cause of the problem?

推荐答案

我已经看到这发生了很多次。在几乎每一种情况下,当写入数组或其他数据结构时,该问题被发现是一个超出界限的错误。在其他情况下,正在使用未初始化的变量。

I have seen this happen many times before. In almost every single case the problem was found to be an out-of-bounds error when writing to an array or other data structure. In other cases, an uninitialized variable was being used.

您的代码中有一个错误。这是肯定的。当你在Debug设置下构建时,编译器会为你屏蔽某些类型的问题。编译器将编写代码来初始化一些东西,掩盖未初始化的变量问题。

You have a bug in your code. That is certain. When you build under Debug settings, the compiler does a whole lot of stuff for you that masks certain types of problems. The compiler will write code that zero-initializes some stuff, masking uninitialized variable problems.

我尝试的第一件事就是将警告级别调到最高设置。你应该这样做所有的时间。这往往会揭示这个问题。只需确保修复编译器告诉您的问题。不要用 #pragma s或chintzy casts来掩饰它们。下一步通过你的代码来隔离问题。这可能是困难和耗时,但有一个银衬里。无论什么问题,你重复这个错误的可能性与识别和修复bug的时间和难度成反比。 :)

First thing I wold try is cranking up the warning levels to their highest settings. You should be doing this all the time anyways. This will very often reveal the problem. Just be sure to fix the problems the compiler tells you about. Don't mask them with #pragmas or chintzy casts. Next step through your code to isolate the problem. This can be difficult and time consuming, but there's a silver lining. Whatever the problem is, the likelyhood of you repeating that mistake is inversely proportional to how long and how hard it is to identify and fix the bug. :)

这篇关于visual studio 2008解决方案发布版本运行时致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆