Solved

Preprocessor directive from running within Developer Studio?

Posted on 2001-06-20
5
202 Views
Last Modified: 2013-11-20
I'm creating a little Win32 console app from within Developer Studio.  Whilst I am developing in debug, I am putting

#ifdef _DEBUG
getchar();
#endif

statements in various places, to stop the console window disappearing when the program terminates.

I would like to know if there is a preprocessor directive similar to _DEBUG that stipulates that the program is being executed from Developer Studio, rather than the command line such as _DEVELOPERSTUDIO.  This would eliminate the confusion of having to hit return if the debug version of the program was run on the command line.
0
Comment
Question by:carlpaddick
  • 4
5 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 6211651
simply do a runtime check instead, pre-processor directives are resolved at compile time so they will be still there when running in DevStdio or on cmd line

/* global */
int stopper = 0;

then in main set it to 1 if your passed a certain command line option

in the code
if(stopper) getch();

open project settings and add the option
0
 
LVL 10

Accepted Solution

by:
makerp earned 50 total points
ID: 6211653
whoops

>>open project settings open the debug tab and add teh command line argument
0
 
LVL 10

Expert Comment

by:makerp
ID: 6211655
anyway really you should compile a release when running out of DevStd, this would completley solve all probs
0
 

Author Comment

by:carlpaddick
ID: 6213417
Thanks for all of your comments makerp.  You've posted some very useful ones.  Please have the points.
0
 
LVL 10

Expert Comment

by:makerp
ID: 6213427
cheers, glad to help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

864 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now