473,785 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking active solution configuration at compile time

Hi!
Is it possible to check the active solution configuration (debug, release or some user defined) at compile time using for example preprocessor directives?

Best regards,
Michael
Nov 17 '05 #1
3 2400
"Michael" <Mi*****@discus sions.microsoft .com> wrote in message
news:5E******** *************** ***********@mic rosoft.com...
Is it possible to check the active solution configuration
(debug, release or some user defined) at compile time
using for example preprocessor directives?


While it is not exactly what you asked, do you know that an easy thing to do
is to check for the presence of debug options is to use something like

#ifdef DEBUG
// ...
#endif

You might want to look at the "Command Line" options under the C++ section
of your project's properties. The options that start with /D are the ones
which set preprocessor symbols.

I would guess that the automation/macro support in the compiler would allow
you to get the information you seek but to be honest that's just a guess as
I have never set out to look for it.

Regards,
Will
Nov 17 '05 #2
Well, I've already thought of this solution. I've seen something like

IF CONFIG = "Debug"

END IF

posted in other newsgroups but it seems like it only works with VB. I guess I'll have to use the proposed solution.

Regards,
Michael

"William DePalo [MVP VC++]" wrote:
"Michael" <Mi*****@discus sions.microsoft .com> wrote in message
news:5E******** *************** ***********@mic rosoft.com...
Is it possible to check the active solution configuration
(debug, release or some user defined) at compile time
using for example preprocessor directives?


While it is not exactly what you asked, do you know that an easy thing to do
is to check for the presence of debug options is to use something like

#ifdef DEBUG
// ...
#endif

You might want to look at the "Command Line" options under the C++ section
of your project's properties. The options that start with /D are the ones
which set preprocessor symbols.

I would guess that the automation/macro support in the compiler would allow
you to get the information you seek but to be honest that's just a guess as
I have never set out to look for it.

Regards,
Will

Nov 17 '05 #3
It's as good a solution as any. Stick a Preprocessor Define (in the Project
configs) for each of your configs. I think DEBUG is automaticaly defined for
Debug builds, and it's easy to add some more for other configurations.

Steve

"Michael" <Mi*****@discus sions.microsoft .com> wrote in message
news:E0******** *************** ***********@mic rosoft.com...
Well, I've already thought of this solution. I've seen something like

IF CONFIG = "Debug"

END IF

posted in other newsgroups but it seems like it only works with VB. I guess I'll have to use the proposed solution.
Regards,
Michael

"William DePalo [MVP VC++]" wrote:
"Michael" <Mi*****@discus sions.microsoft .com> wrote in message
news:5E******** *************** ***********@mic rosoft.com...
Is it possible to check the active solution configuration
(debug, release or some user defined) at compile time
using for example preprocessor directives?


While it is not exactly what you asked, do you know that an easy thing to do is to check for the presence of debug options is to use something like

#ifdef DEBUG
// ...
#endif

You might want to look at the "Command Line" options under the C++ section of your project's properties. The options that start with /D are the ones which set preprocessor symbols.

I would guess that the automation/macro support in the compiler would allow you to get the information you seek but to be honest that's just a guess as I have never set out to look for it.

Regards,
Will

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
4590
by: Surya Kiran | last post by:
Hi all, I've written a function template. say template <class T> fn (T var) { ... } Is there any way, from within the function, can we check what type of argument we've passed on to the function (double, float etc) ?? Thanks in advance,
2
274
by: Tom | last post by:
I am working in a team environment and we have followed the single solution model for our developement. We are about 25% of the way through our project and Visual Studio is taking 5 minutes to build the entire solution. The machines that we are using are 1.8 Ghz with 512 Mg of memory. We have considered switching to a partitioned solution but we feel any UI layer forms will still take a long time to build because for the references to...
4
1700
by: Tim Marsden | last post by:
HI, I am developing a application in vb.net. I split down my functionality into several separate DLL's. The solution is becoming very large, nearly 100 projects, each project a dll's. There is one entry exe. It is very slow to load and compile now. All my references are project references, is there a standard way to split the solution. In the past I have had versioning problems if a compile groups of projects individually.
6
3334
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for my particular application. One of the advantages is that the _compiler_ can force inner matrix dimensions used in multiplication to agree. A _complie-time_ error will be triggered if you write A * B and the number of coluns in A does not equal the...
6
3324
by: Baskar RajaSekharan | last post by:
In C-sharp, I wnat to know whether the Component is compiled in Debug Mode or Run Mode through Code. How is it possible? Is there any way to Access the Config file and check? Please let me know with example
1
3962
by: techfuzz | last post by:
I'm posting my problem experience and solution I found here for other ASP.NET developers. I have a web application that uses Forms Authentication with Active Directory to control access. In this web application, I have search page that utilizes the Windows Indexing Service (MSIDXS provider). For reasons I'm not aware of at this time, setting <identity impersonation="true" /> in the web.config causes an error whenever you try to search.
3
6035
by: SStory | last post by:
I would like to have some code compile if my Active Configuration is set to debug and not compile if it is set to Release. I don't want to have to remember to define a constant. I just want to change configurations and all debug code not execute. How is this possible. Thanks in advance,
2
7417
by: Venkata Narayana | last post by:
Hi, You all may be knowing that Connection.isClosed() does not tells us if the underying DB connection is active or not; it only checks if Connection.close() had been previously called or not. One sure shot way to find out this is by executing some dummy SELECT query and catching it via SQLException. This could be done in various DB's as follows: SELECT * from 1 (MS SQL) SELECT * from DUAL(Oracle)
11
4276
by: Bryan Crouse | last post by:
I am looking a way to do error checking on a string at compile time, and if the string isn't the correct length have then have the compiler throw an error. I am working an embedded software that will require individual builds for each device so that the device serial number is contained in the program memory. To do this, the C application must be compiled with the serial number assigned to a variable within the source code file. I...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.