I'm running Arduino IDE 1.6.10 on Mac OS X 10.12.1. I read on the Arduino official sote that the IDE should create function prototypes for me, and it always did. But now I'm writing a 1500 lines program, with dozens of functions, and this tool wold be quite useful (although I obviously don't really need it)... and it doesn't work. Is that a known issue?
3 Answers
Do yourself a favour and dont rely on those automatic tools.
Type your code and know every line you typed.
And give PlatformIO a try instead of the Arduino IDE. You will save yourself and coworkers a lot of grief.
There are some times when it can't make prototypes, and some when it just gets it plain wrong. It struggles if you do fancy things with any of your functions, such as adding attributes or using anything that's even slightly out of the ordinary.
Also sometimes it places the prototypes in completely the wrong place, especially if you are working with structs, etc.
Unfortunately various things make the prototype generation fail. I think they run a regexp on the code which doesn't detect all cases. Examples are:
- Function definition split over multiple lines
- Use of templates
- Use of user-defined types in a function definition
Here is one bug report:
https://github.com/arduino/Arduino/issues/472
It's not that hard to take your function definition and make a prototype out of it. It's good practice anyway to get into the habit of it. If you get into larger projects where functions are in different files you need to do this anyway.