Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1409
  • Last Modified:

#ifdef DEBUG


I have been trying to use the TRACE facility when debugging but
can never seem to find the messages I output

#idef DEBUG
    TRACE("Some message");

how can I find the output from this in the debugger.

  • 2
1 Solution
1) To see TRACE output you need to run the program under debugger (use Go unstead of Run command).

2) Use \n in each debug message:

TRACE("Some message\n");

3) MFC TRACE is defined only in DEBUG configuration, you can use it without #ifdef. In Release configuration it does nothing.
mjwilliamsonAuthor Commented:
I have run under debugger but I see none
of the messages that ive put out.
Right-click on DEBUG and select "Go to definition". Is this symbol defined? Maybe you are not in Debug Configuration.

Right-click on TRACE and select "Go to definition". What is it's definition?

Replace TRACE to OutputDebugString. Do you see something now?

When program is running under Debugger, right-click on Visual Studio toolbar and ensure that Output window is checked.

Be sure that this code is actually executed - set breakpoint on it and select Build - Start Debug - Go.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now