Visual Studio 2008输出窗口停止工作 [英] visual studio 2008 output window stopped working

查看:140
本文介绍了Visual Studio 2008输出窗口停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS 2008中从事C ++项目已有一段时间了.直到最近,终止我的应用程序后,输出窗口仍会显示是否存在内存泄漏.但是,几天前,我注意到它停止显示此有价值的信息.我也尝试过扔一些printf(),但是输出窗口也没有显示出来.

i've been working on a C++ project for some time now in VS 2008. Until recently, upon terminating my application the output window would show if i had any memory leaks. however, a few days ago i noticed it stopped showing this valuable information. i also tried throwing some printf() around, but the output window isn't showing that either.

我猜我在某个地方更改了偏好,但似乎找不到.现在显示的所有输出是已加载/卸载的dll.有什么想法吗?

i'm guessing i changed a preference somewhere, but i can't seem to find it. all the output shows now is which dll's it has loaded/unloaded. any ideas?

谢谢, 迈克

推荐答案

根据我自己的经验,内存泄漏输出丢失的原因可能是不同的.总结最重要的内容:

From my own experience, the memory leak output gone missing can be due to different reasons. to summarize the most important ones:

  1. 更改源代码:

  1. Changes in the source code that:

  • 禁用内存泄漏报告(即,使用 _CrtSetDbgFlag )
  • 安装自定义报告挂钩(请参见_CrtSetReportHook,请参见 _CrtSetReportHook2 )
  • 将输出重定向到文件(请参阅 CrtSetReportMode
  • 源代码中的更改导致应用程序终止时发生静默的崩溃"-在到达报告内存泄漏的点之前,应用程序以静默方式终止而没有任何问题的迹象(这似乎不太可能发生,这似乎不太可能发生)
  • disable memory leak reporting (i.e. using _CrtSetDbgFlag)
  • install custom report hooks (see _CrtSetReportHook, _CrtSetReportHook2)
  • redirect the output to a file (see CrtSetReportMode
  • changes in the source code that lead to silent "crashes" on application termination - the application silently terminates without any indication of a problem before reaching the point where the memory leaks are reported (as improbable this might seem I had this once).

开发环境中的设置导致输出重定向到另一个窗口.一种可能是:工具\选项\调试\常规\将所有输出窗口"文本重定向到立即窗口"(从底部开始的第五个).可能还有其他可能性.

Settings in the development environment cause the output to be redirected to another window. One possibility would be: Tools \ Options \ Debugging \ General \ Redirect all Output Window text to the Immediate Window (the fifth from bottom). Probably other possibilities exist here.

我想排除第2点的一种可能性是在(main.cpp)行中创建一个简单的控制台应用程序:

I guess one possibility to rule out point 2 would be to create a simple console application in the lines of (main.cpp):

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

#ifndef DEBUG_NEW
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif

int _tmain(int argc, _TCHAR* argv[])
{
    int nOldState = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
    _CrtSetDbgFlag(nOldState | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

    int *pInt = new int[100];
    return 0;
}

如果正确运行此应用程序会输出内存泄漏,那么很遗憾,您可能会遇到情况1

If running this application correctly outputs memory leaks then unfortunately you are probably in case 1

我当然排除了为什么输出消失的显而易见的事情(其中一些已经在注释中提到).

Of course I ruled out the obvious things why the output could be gone (some of them already mentioned in the comments).

这篇关于Visual Studio 2008输出窗口停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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