#ifdef DEBUG

Posted on 2003-03-16
Medium Priority
Last Modified: 2013-11-20

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.

Question by:mjwilliamson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 48

Expert Comment

ID: 8146226
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.

Author Comment

ID: 8146347
I have run under debugger but I see none
of the messages that ive put out.
LVL 48

Accepted Solution

AlexFM earned 100 total points
ID: 8146387
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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question