You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do not have time to chase this issue at the moment, but if I find time I will try to track down the cause and append more info. The issue is this:
Different computers have proven to be inconsistent in where they put the #include arduino.h line.
It is always before setup loop, which is good, but in an example today there was an issue.
I was supporting two different hardware designs, one using software serial and one using hardware serial. There was therefore the following code above the setup loop:
sudo code:
#ifdef IS_DESIGN_1
//declare software serial
#endif
The arduino IDE chose to add the include in the middle so that the following occurred:
#ifdef IS_DESIGN_1
//declare software serial
#include "arduino.h"
#endif
Due to the fact that the design 1 bit didn't currently apply, the compiler missed the include and spit out a bunch of errors. The problem was resolved by manually including arduino.h, but looking in the tmp file that was generated, I can see that it was still ALSO included inside the #ifdef. This code should be reviewed to avoid this.
I will work on it if I have time, but meanwhile if anyone more familiar with the way the arduino ide build system functions, perhaps you could guess at why this is happening. I do not think it is unreasonable for #ifdef to exist in the header of a file. I know that is not typical of arduino, but in the embedded world where I typically work that is fairly standard practice.
The text was updated successfully, but these errors were encountered:
I do not have time to chase this issue at the moment, but if I find time I will try to track down the cause and append more info. The issue is this:
Different computers have proven to be inconsistent in where they put the #include arduino.h line.
It is always before setup loop, which is good, but in an example today there was an issue.
I was supporting two different hardware designs, one using software serial and one using hardware serial. There was therefore the following code above the setup loop:
sudo code:
The arduino IDE chose to add the include in the middle so that the following occurred:
Due to the fact that the design 1 bit didn't currently apply, the compiler missed the include and spit out a bunch of errors. The problem was resolved by manually including arduino.h, but looking in the tmp file that was generated, I can see that it was still ALSO included inside the #ifdef. This code should be reviewed to avoid this.
I will work on it if I have time, but meanwhile if anyone more familiar with the way the arduino ide build system functions, perhaps you could guess at why this is happening. I do not think it is unreasonable for #ifdef to exist in the header of a file. I know that is not typical of arduino, but in the embedded world where I typically work that is fairly standard practice.
The text was updated successfully, but these errors were encountered: