How Do You Turn Off the Debugger?

C

Clifton M. Bean

In C++ within Visual Studio as well as within UNIX ...

I need to turn off/on debug statements. I do not want to comment out these
statements.

I am guessing that I can use:

#ifdef DEBUG
.... statements ...
#endif

I use DEBUG as an identifier.

Where should I define this identifier? Can it be done within a makefile for
UNIX? Or in some text field in Project Settings in Visual Studio 6
Environment?

..... or is this there a better way?

Thank you in advance.
Kathryn ([email protected])
 
R

Rob Williscroft

Clifton M. Bean wrote in
In C++ within Visual Studio as well as within UNIX ...

I need to turn off/on debug statements. I do not want to comment out
these statements.

I am guessing that I can use:

#ifdef DEBUG
.... statements ...
#endif

I use DEBUG as an identifier.

Where should I define this identifier? Can it be done within a
makefile for UNIX? Or in some text field in Project Settings in
Visual Studio 6 Environment?

.... or is this there a better way?

define NDEBUG on the compilers comand line -DNDEBUG (*) this has
the advantage that it will turn off the assert() macro from <cassert>.
In your development enviroment you will have to find the the correct
place to make such a define.

For things not covered by assert() use:

#ifndef NDEBUG
// debugging code here
#endif

or if you like to type alot:

#if !defined( NDEBUG )
// debugging code here
#endif

(*) Not all compilers will use this syntax (just most :), check
your compilers documentation.

Rob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top