为什么在DEBUG模式下使用TRACE,在输出窗口中却看不到TRACE输出的结果?

littlepig_2002 2005-05-31 05:56:53
VC6,VC7的DEBUG,OUTPUT窗口中都看不到输出结果? 是在DEBUG模式下调试的。是不是应该设置什么呀?
...全文
342 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
younggle 2005-06-01
  • 打赏
  • 举报
回复
是不是没有执行到 TRACE 的语句啊?
不然怎么不能输出呢!
检查一下。
littlepig_2002 2005-06-01
  • 打赏
  • 举报
回复
up
subtop 2005-05-31
  • 打赏
  • 举报
回复
To help debug windows programs, MFC provides a TRACE output mechanism. This will display, to a debugging output window or console, messages about the internal operation of the MFC library as well as warnings and errors if something goes wrong in your application.

Turning on TRACE output is strongly recommended, since it will sometimes give you advanced warning of problems that are about to occur or give more verbose reasons why problems do occur.

How to Turn on TRACE Output

By default TRACE message output is disabled. In order for trace output to be seen, you must perform the following steps:

Compile your program with the _DEBUG symbol defined and link with a debug version of the MFC library. Debugging and trace options are only available in the _DEBUG version of the library.


Enable the afxTraceEnabled flag. There are several ways to do this, but using theTRACER.EXE utility is highly recommended.


Customize the afxTraceFlags to the level of detail you would like to see in trace messages. Use of the TRACER.EXE utility is highly recommended.
Where the Output Goes

When afxTraceEnabled is TRUE, then TRACE output (and default afxDump output) will go to the output window if present. When afxTraceEnable is FALSE, TRACE output and afxDump output will not be displayed.

If a debugger is present, then TRACE output will go to the debugger's output window. If no debugger is present, then TRACE output will not be seen.

Using TRACER.EXE

TRACER.EXE is a small MFC Programming Utilities sample program that allows you to set the options in AFX.INI. TRACER is installed in your BIN directory by the Visual C++ setup. The source code for TRACER is provided as well, so you can rebuild it and customize it as you wish.

A sample AFX.INI file is provided in the MFC\SRC subdirectory. This .INI file turns on diagnostic messages and uses the standard options. You should place this AFX.INI file in your Windows directory or run theTRACER.EXE program to create a new AFX.INI file and set options in it using a dialog box.

Any changes to AFX.INI will take effect in any debug MFC application launched after the changes are saved.

The global integer afxTraceFlags is used to turn on the built-in reporting features of the MFC and to store all flags. It can be set under program control or with the debugger. The global integer afxTraceFlags uses each bit to select a trace reporting option.

You can turn any bit on or off as desired. Try playing with them to get a flavor of the report information they generate. See the AFXWIN.H header for the numeric values of the different options.

// example under program control
afxTraceFlags = 4 + 8; // windows message dumping

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧