如何获得输出以显示在Visual Studio 2005错误列表的“消息"窗格中? [英] How do I get output to show up in the Messages pane of the Error List for Visual Studio 2005?

查看:165
本文介绍了如何获得输出以显示在Visual Studio 2005错误列表的“消息"窗格中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的头文件:

I have a header file like this:

#ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
#define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__

  #ifdef _DEBUG

    // macros for turning a number into a string
    #define STRING2(x)  #x
    #define STRING(x)  STRING2(x)

    #ifdef TRIAGE_MESG_AS_WARNING
      #define TRIAGE_TODO_TAG(description)    __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE TO-DO: " STRING(description) ))
      #define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE FIXTHIS: " STRING(description) ))
    #else
      #define TRIAGE_TODO_TAG(description)    __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE TO-DO: " STRING(description) ))
      #define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE FIXTHIS: " STRING(description) ))
    #endif
  #else
    #define TRIAGE_TODO_TAG(description)
    #define TRIAGE_FIXTHIS_TAG(description)
  #endif

#endif // __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__

将注释输出到Visual Studio 2005的输出窗格中.当定义了"TRIAGE_MESG_AS_WARNING"时,Visual Studio将收集这些消息并将它们作为错误列表列出为警告.这样做是因为文本格式与警告匹配.但是,我不希望它们始终显示为警告,而是希望它们显示在错误列表"的消息"窗格中.

Which outputs notes to the output pane in Visual Studio 2005. When 'TRIAGE_MESG_AS_WARNING' is defined, Visual Studio will harvest these messages and list them as warnings in the Error List. It does this because the text format matches a warning. However, I don't want them to show up as warnings all the time, I would rather they show up in the Messages pane of the Error List.

如何格式化放在 输出窗口"使Visual Studio 会自动将它们显示在 错误列表"的消息"选项卡 窗口?

How do you format lines you put in the "Output Window" so that Visual Studio will auto-magically show them in the "Messages" tab of the "Error List" window?

我在上面的代码中为消息设置的格式看起来像来自其他输出的消息,但不会以相同的方式收集.

The format I have setup for messages in the above code looks like a message from other output, but does not get harvested in the same way.

一位同事向我建议,我可能需要写一个自定义自动化对象"以写到消息"窗格中.这看起来很痛苦,尤其是因为仅通过适当的格式来结束错误"窗格和警告"窗格中的条目就变得微不足道了.这可能吗?

A co-worker suggested to me that I might need to write a 'custom automation object' to write to the Messages pane. That seems like a pain, especially since it is trivial to end-up with entries in the Error pane and Warning pane simply by proper formating. Is this a possible avenue?

我们使用的是非托管C ++,因此我们不能仅依靠托管(.NET)工具.我们不想用钩子扩展VS.

We're using unmanaged C++, so we can't rely on managed (.NET) only tooling. We do not want to extend VS with hooks.

推荐答案

我相信他们只是 忘记了 ,以添加其他类别:信息. 至少没有为外部工具以输出格式指定它.

I believe they just forgot about adding additional category: info. At least it is not specified in output format for external tools.

引用:类别必须是'错误'或'警告'.大小写无关紧要.像起源一样,类别不得本地化."

Citation: "Category must be either 'error' or 'warning'. Case does not matter. Like origin, category must not be localized."

链接: http://blogs.msdn.com/msbuild/archive/2006/11/03/msbuild-visual-studio-aware-error-messages-and-message-formats.aspx

这篇关于如何获得输出以显示在Visual Studio 2005错误列表的“消息"窗格中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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