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 ino file prorperties (Read 1401 times)
JamesFarmer
Junior Member
**
Offline


Posts: 58
Joined: Mar 1st, 2020
ino file prorperties
Mar 3rd, 2020 at 10:17pm
Print Post  
this is two part topic 

1. once you have changed the property setting under ino file to false to include in project the file disappears how can I change that property back

2.  what I trying to do is have couple different main program or  ino files so I can activate the one I want to build for release
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ino file prorperties
Reply #1 - Mar 3rd, 2020 at 10:36pm
Print Post  
1.

There is a small icon above the solution explorer that has a tool tip of "Show all files". Click it to see physical files on disk instead of the filter view.

Then right click any files or folders to "Include in Project" or "Exclude from Project"

2.  How to set per-configuration defines to conditionally #include code.

I suggest you put conditional code in .h and .cpp files then #include the correct functionality conditionally using a compiler #define.

For example in the Visual Micro project properties you can set configuration specific compiler defines myDefine=foo;myDefine2=bar

#if myDefine == foo
   //some code
#endif

or easier still use the configuration specici "_DEBUG" project property. ie: Set _DEBUG to 0 or 1 when Release is selected and set it to 1 or 2 when Debug is selected. Then in your code use

#if _DEBUG == 0
#if _DEBUG == 1

Or just set the _DEBUG property for the Debug configuration and test for the define

//release
#if !defined(_DEBUG)
#include "myheader1.h"
#endif

//debug
#if defined(_DEBUG)
  //some code
#include "myheader1.h"
#end if


I recommend external h/cpp but you can wrap any code in the .ino sources using or one more #defines. Code can get out of control very quickly and be difficult to read. 

As far as .ino files are concerned all the .ino code will be compiled in one "combined block", however code in #if conditions will be ignored by the compiler. 

For cpp/h files if a header file #include is wrapped in a #define, then the related .cpp file(s) are not passed to the compiler or linked as objects.
  
Back to top
WWW  
IP Logged
 
JamesFarmer
Junior Member
**
Offline


Posts: 58
Joined: Mar 1st, 2020
Re: ino file prorperties
Reply #2 - Mar 4th, 2020 at 1:22am
Print Post  
say i have three ino or main program file and i want to exclude all but one from the build how can i do that
« Last Edit: Mar 4th, 2020 at 1:25am by JamesFarmer »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ino file prorperties
Reply #3 - Mar 4th, 2020 at 3:08am
Print Post  
You have to wrap the code with an #if
  
Back to top
WWW  
IP Logged
 
JamesFarmer
Junior Member
**
Offline


Posts: 58
Joined: Mar 1st, 2020
Re: ino file prorperties
Reply #4 - Mar 4th, 2020 at 9:51pm
Print Post  
is ther an example you can point me at
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ino file prorperties
Reply #5 - Mar 4th, 2020 at 9:52pm
Print Post  
examples are in my previous comment.
  
Back to top
WWW  
IP Logged
 
JamesFarmer
Junior Member
**
Offline


Posts: 58
Joined: Mar 1st, 2020
Re: ino file prorperties
Reply #6 - Mar 6th, 2020 at 7:44pm
Print Post  
got it thank you
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint