Solved

Preprocessor directive from running within Developer Studio?

Posted on 2001-06-20
5
201 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
Comment Utility
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
Comment Utility
whoops

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

Expert Comment

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

Author Comment

by:carlpaddick
Comment Utility
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
Comment Utility
cheers, glad to help
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

6 Experts available now in Live!

Get 1:1 Help Now