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 Why are excluded source files included in the compilation (Read 4108 times)
Shyam B
Junior Member
**
Offline


Posts: 18
Location: Netherlands
Joined: Aug 3rd, 2012
Why are excluded source files included in the compilation
Sep 29th, 2012 at 11:26pm
Print Post  
Hi,

I just noticed that VM tries to build all files (in the current folder) visual studio is using for the project. This should not be the case. 

Steps to reproduce:
1) Start Visual Studio (2010). Open an 'Arduino project' and select some .pde file under some folder. Like from examples folder under libraries in APM. (Try to have a single .pde in the same named folder for reproducing the bug).
2) Build -> It builds fine.
3) Add another .pde file from somewhere else to the current folder (not into VS solution), just place it in the folder.
4) Now, add this new .pde file to the solution.
5) Build the solution, build (might) fail as it tries to compile all .pde's within a solution. Till here, it is Ok.
6) EXCLUDE the .pde (by right click on the file and Exclude from project) added in step (4), and build again. The build fails again. This should not happen.

I think it is reproducible every time this procedure is followed, please help fix this as it becomes difficult working with bigger projects as this procedure happens often. Thanks! Smiley
« Last Edit: Oct 9th, 2012 at 12:49pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
The Arduino rules are that all source files in the sketch folder are part of the program
Reply #1 - Sep 30th, 2012 at 12:00am
Print Post  
Hi Shyam, Yes this is correct. It is not a bug because this is an Arduino rule. 

Arduino does not have the concept of a project so it builds all files in the sketch folder. The Visual Micro addin is 100% compatible with Arduino, which is good and bad  Smiley

You will see that if you close and reopen any Arduino project, visual micro will add back any files that you previously remove from the project. so you have to move or delete them.

If we allowed anything else then we would loose compatibility with Arduino and the APM make files would also fail.

An option is to create a folder below the sketch with a name such as "Obsolete". Then move any files you don't want to include in the project into the folder. Another Arduino rule is that it only builds files in the sketch folder, sub folders are ignored. 

We can make great use of this feature. Click on the project node in the solution and then click "Project>Show all arduino files". Notice all of the apm libraries are included in the project. Click the menu again to remove the libs. This shows we can add any files we like to the solution to help us develop and see code more easily but all that is compiled is what the Arduino IDE normally sees.
« Last Edit: Oct 9th, 2012 at 12:49pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Why are excluded source files included in the compilation
Reply #2 - Sep 9th, 2015 at 10:05pm
Print Post  
Update for anyone else reading this post ...

The latest release of Visual Micro allows the Arduino rules to be broken. Code can be in sub folders, the files linked into the solution will be compiled. There is a new "Compatibility" section in Tools>Options which enables the various new features to be disabled if Strict Arduino compatibility is required.

Arduino library sources can also be copied to a designated folder structure below each project. The library sources are compiled and #included in the exact same way as normal Arduino libraries. This means that libraries can be developed and then published/copied to the master Arduino library list and shared within other projects. A new "Add>New Arduino Library" menu item provides a quick way to create a new library but they can also be created manually.

It appears to also now be possible to share code between multiple projects but this has not been well tested.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint