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 #define based on Solution Configuration (Read 4961 times)
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
#define based on Solution Configuration
Feb 12th, 2016 at 1:07pm
Print Post  
Hello,

Is there a way for the arduino-code to 'know' what Solution Configuration (Debug / Release) is used?

I would like to change the behaviour of the code based on the Solution Configuration used for compiling. building and uploading.

Example: When solution config 'Prototype' is used then some buttons in my sketch are randomly simulated as being pressed, while with config 'Production' the actually checks if the buttons were pressed.

Of course I can create some #define at the beginning and let that do the work, but then I need to remember to change that every time.
So it would be great if I can 'read' the used Solution Configuration at compile-time.

Thanks for your suggestions

Grtz,
GJ
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: #define based on Solution Configuration
Reply #1 - Feb 12th, 2016 at 1:28pm
Print Post  
Hi,

Yes there are a few ways.

Take a look at the visual micro project properties. There is a "defines - configuration" where by you can set a semi-colon separated list of defines ((a=1;b=2)

The DEBUG level is also configuration specific.

Hope this makes sense.
  
Back to top
WWW  
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: #define based on Solution Configuration
Reply #2 - Feb 12th, 2016 at 1:35pm
Print Post  
Hmm, selecting "Visual Micro" and then "Project Properties" only gives me:
Misc
  • (Name)
  • Active Config: Debug|x86
  • Description:
  • Path:
  • Startup project

Undecided

Using Visual Studio Community 2015 14.0.24720.00
« Last Edit: Feb 12th, 2016 at 1:45pm by gj »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: #define based on Solution Configuration
Reply #3 - Feb 12th, 2016 at 1:51pm
Print Post  
You need to click the project. You are actually looking at solution properties
  
Back to top
WWW  
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: #define based on Solution Configuration
Reply #4 - Feb 12th, 2016 at 2:02pm
Print Post  
Ah, that's different indeed.


So, any hints on where to look?
So far nothing found that looks like "defines"
« Last Edit: Feb 12th, 2016 at 2:03pm by gj »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: #define based on Solution Configuration
Reply #5 - Feb 12th, 2016 at 2:09pm
Print Post  
Please use the visual micro menu or tool bar to.open the properties. It does.it all for you or see docs

Thanks
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint