About
Pricing
Community
Teams
Start Free Trial
Log in
longjumps
asked on
12/30/2012
MS VS 2010 C++ project - how to define DEBUG var?
I have project and imported source regex.c
In this source I have
# ifdef DEBUG
.....
How to add this to project in order to get debugging information?
Where it prints?
Sources are attached.
regex.c
xregex.h
Visual C++.NET
Windows Server 2008
15
1
Last Comment
longjumps
8/22/2022 - Mon
AndyAinscow
12/30/2012
When you select the DEBUG (as opposed to RELEASE) build then it is already defined for you.
AndyAinscow
12/30/2012
>>Where it prints?
If you use a TRACE command it prints to the output window (which is in visual studio)
longjumps
12/30/2012
ASKER
How to use Trace command?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
AndyAinscow
12/30/2012
eg.
TRACE(_T("In put your function/class/whatever here"));
or
TRACE(s); //s is a string variable, eg with the value of some other variable in it
longjumps
12/30/2012
ASKER
The question was related to
# ifdef DEBUG
and in the source I have already debugging printings like
DEBUG_PRINT1 ...
and others.
So the question is how should I compile and run this code in Visual Studio 2010 to see the existing printing and not adding new TRACEs?
AndyAinscow
12/31/2012
Build it as a debug build (see my original comment).
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
longjumps
12/31/2012
ASKER
I don't see "Active Debug".
What should I do?
See attachment.
vs2010-no-active-debug.png
AndyAinscow
12/31/2012
In my snapshot there are only two project configurations defined. Debug and Release. That show the currently selected (=active) one is debug.
longjumps
12/31/2012
ASKER
Dear, if I need something define or add, please advice how.
I simply wants that in the lib code I compile and run get debugging printing, using already existing in the code
# ifdef DEBUG
.....
DEBUG_PRINT1 ...
and others.
I attached lib code to the original question.
Please advice.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
AndyAinscow
1/1/2013
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
longjumps
1/1/2013
ASKER
But how to define DEBUG not from code, but compile variable?
AndyAinscow
1/1/2013
You can't.
It is a
compiler
directive to modify how code is compiled.
longjumps
1/28/2013
ASKER
such precompiler directive should be pass from outside of code by compiler.
in Linux there is something -D<var> can I do such thing in Win?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
AndyAinscow
1/28/2013
You can define things in the command line to the compiler BUT it is not a variable. They determine which blocks of code are compiled or not. (See the project settings).
longjumps
2/13/2013
ASKER
checking the solution