2

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).

  • 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. – Gerben Dec 14 '16 at 13:04
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.

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.