1

I would like to be able to exclude from the auto-including process of the current project (without renaming the extension or delete it) a sketch with pde or ino extension that is used in certain circumstances only.

How can I do this?

I currently use Visual Micro to manage projects on Arduino.

Greenonline
  • 3,152
  • 7
  • 36
  • 48
xxx
  • 15
  • 1
  • 4

1 Answers1

1

One possible approach is to guard the body of that sketch with an #ifdef ... #endif pair, and use Visual Micro's “Project Properties” to define (or not) a preprocessor symbol. [If the .ino or .pde in question is used as a #include file, you would instead guard all the #include instances.]

Refer to the “Project Defines” page at visualmicro.com for how to define a preprocessor symbol and its value. [Via: Tools > Options > Visual Micro > Compiler > Show Build Properties] Also see How do I add additional compiler switches in Visual Studio.

If necessary, you can use other tests besides #ifdef to control compilation. The first link above shows the following example.

#if USBPORT > 3
....your code here....
#endif
James Waldby - jwpat7
  • 8,920
  • 3
  • 21
  • 33