Page 1 of 1

Arduino IDE fails to collect function headers

Posted: Thu May 07, 2020 9:14 am
by Phono
It has been several times I experience this issue, over several years.
I am using the Arduino IDE 1.8.12 with the STM32Duino package installed.
I have a large sketch (2285 lines after merging). There are 11 different identifiers that switch blocks of code using many nested #ifdef...#else...#endif structures, providing for various options.
I sometimes have compile errors like

Code: Select all

'TacheEmissionSerie' was not declared in this scope; did you mean 'hTacheEmissionSerie'?
When I look at the global file generated by the IDE, I notice that the IDE failed to collect the header of one or more functions to put them at the top of the code as it does normally.
I also experience unexpected execution results, as if some lines of code were missing or displaced.
This only occurs when the #ifdef...#endif structures are many.
Is this flaw known? Could the IDE development team take this issue into account?

Re: Arduino IDE fails to collect function headers

Posted: Thu May 07, 2020 10:10 am
by stevestrong
I haven't ever used Arduino IDE for code editing, only for compile/build test bench.

Usually I do not use code with many (more than 2..5) #ifdefs, so I have not observed such a behavior.

But with many #ifdefs you can yourself introduce some errors into the sketch.
If it gives you some alternative, it means it still does parse the headers.

Re: Arduino IDE fails to collect function headers

Posted: Thu May 07, 2020 1:04 pm
by stas2z
just declare your function prototypes by yourself before it used in your code
I think it's a bad style to let ide create declarations for you even if it can

Re: Arduino IDE fails to collect function headers

Posted: Thu May 07, 2020 1:22 pm
by Phono
I eventually found what was wrong.
A statement did end with a ":" instead of a ";".
This fooled the IDE mechanism, but instead of flagging the mistake, it behaved badly.
After changing this character to a ";", the IDE worked well again.
It is always difficult to find a mistake when it is not detected as such by the IDE which just went astray. It is by chance I found it.

Re: Arduino IDE fails to collect function headers

Posted: Thu May 07, 2020 1:24 pm
by fpiSTM
I never met this kind of issue and I already build sketch bigger than yours.
Probably you got an issue in your sketch which prevents to parse it properly.
Anyway I'm agree with stas2z and I doesn't like the way Arduino "process" all input files.