Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Preprocessor directive from running within Developer Studio?

Posted on 2001-06-20
5
Medium Priority
?
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

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 …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

688 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