Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Preprocessor directive from running within Developer Studio?

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
carlpaddick
Asked:
carlpaddick
  • 4
1 Solution
 
makerpCommented:
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
 
makerpCommented:
whoops

>>open project settings open the debug tab and add teh command line argument
0
 
makerpCommented:
anyway really you should compile a release when running out of DevStd, this would completley solve all probs
0
 
carlpaddickAuthor Commented:
Thanks for all of your comments makerp.  You've posted some very useful ones.  Please have the points.
0
 
makerpCommented:
cheers, glad to help
0

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!

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