3

I know that the Arduino IDE does some simple tasks automatically: for example it creates function prototypes, but this function sometimes fails.

Does that IDE run other hidden "pre-precompiler" tasks?

Is there a way to disable them? (this question refers especially to the function prototypes creator).

dda
1,5951 gold badge12 silver badges17 bronze badges
asked Dec 14, 2016 at 10:16
1
  • You could place all your code in a separate .cpp file, and call that from your .ino file. That way your ino file will just be a few lines. You might even be able to just use a single include. Commented Dec 14, 2016 at 13:04

1 Answer 1

2

The IDE runs a "preprocessing" routine. As well as adding prototypes it also:

  • Adds #include <Arduino.h> to the start of your sketch
  • Removes comments (or the older versions did, I am not sure about arduino-builder)
  • Identifies the libraries #included in the sketch

The latter is used to build the list of -I ... directories to add to the command line. Removing of comments was chiefly to make finding functions easier for making function prototypes (though there are better ways of doing both those and arduino-builder might use them).

Can you disable it? No. Not for .ino files. However, any .cpp files added to your project are treated as vanilla C++ source code and aren't preprocessed in this way.

answered Dec 14, 2016 at 10:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.