Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic _DEBUG set based on Configuration "Debug" or "Release" (Read 1720 times)
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
_DEBUG set based on Configuration "Debug" or "Release"
Dec 3rd, 2021 at 12:05pm
Print Post  
I would like to be able to have the _DEBUG variable (or any other variable?) set to 1 if configuration=Debug and set to 0 if configuration=Release.
I now change this every time manually in the code, but of course forgetting it all the time  Roll Eyes

something like 
Code (C++)
Select All
#ifdef _DEBUG
   Serial.println("This piece only shows when Configuration=Debug.");
   [some other statements that only have to be done in debug-mode]
#endif
 



Is this possible using VM in VS2022?
« Last Edit: Dec 3rd, 2021 at 1:08pm by gj »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: _DEBUG set based on Configuration "Debug" or "Release"
Reply #1 - Dec 3rd, 2021 at 1:55pm
Print Post  
If you open the project properties (highlight project in solution explorer, press F4), there is a setting under Micro General (Current Configuration) called Configuration Define _DEBUG.

If you set this to 1 when in Debug Configuration, this will achieve what you need and when you switch to Release it will become 0 again.

« Last Edit: Dec 3rd, 2021 at 1:57pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: _DEBUG set based on Configuration "Debug" or "Release"
Reply #2 - Dec 3rd, 2021 at 6:01pm
Print Post  
Thanks for the suggestion. 

While F4 didn't work, I selected the project and did a right-click-->Properties. Wrong option
Then, select the project and from the menu Project->Properties (Alt-F7). Wrong option.

But clicking the cog-wheel in the Visual Micro-bar gave me the right options.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: _DEBUG set based on Configuration "Debug" or "Release"
Reply #3 - Dec 4th, 2021 at 12:22am
Print Post  
Good to hear you found the properties. The shortcut keys are dependant on which layout you picked when you first ran visual studio.

In VS a project has "Property Pages" and "Properties Window". When a project is selected in the solution explorer you can see those two options at the bottom of the "View" menu. You will also see the shortcut keys next to the menu items.

If the project is not selected in the solution explorer another code file or branch) you might see the properties window but not for the project.

The "vMicro>Project Properties" that you clicked makes life a bit easier. It first selects the project and then shows the "Properties Window". 

Visual Studio does make this a bit confusing. The word "Window" would normally be associated to a coventional window but if refers to a "tool window". Uggh Smiley
« Last Edit: Dec 4th, 2021 at 12:23am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint