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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.