Closed LarsMichelsen closed 4 years ago
Strange. Trying to create a minimal repro lead me to this:
Super_Simple_RGB_WiFi_Lamp.ion
void setup() {
a();
}
void loop() {
}
Config.ino
void a() {
}
Results in:
/home/lm/git/lm/brettl/Super-Simple-RGB-WiFi-Lamp/Super_Simple_RGB_WiFi_Lamp/Super_Simple_RGB_WiFi_Lamp.ino: In function 'void setup()':
Super_Simple_RGB_WiFi_Lamp:2:5: error: 'a' was not declared in this scope
a();
^
exit status 1
'a' was not declared in this scope
It works once I add the forward declaration before the setup function:
void a();
Strange. Really seems the IDE fails to add those forward declarations.
i have no idea if #13 is a good solution, for me it fixes the problem anyway
Certainly interesting issues here.
I don't know if because you are using Linux but something may have changed and I haven't heard of this problem from anyone else yet. Although it does seem to be an IDE issue, the solution falls to who ever is writing the sketch. So this is a weird error to patch to say the least.
At this stage i'm not sure that I will just to keep the sketch looking simple to allow more beginner programmers to hopefully follow along. If you have managed to fix your issue in that pull, I will keep it open and potentially merge it in later if the problem persists.
Thanks for the feedback, much appreciated
Describe the bug
I am unable to compile the sketch using arduino-1.8.10 on Ubuntu 18.04.
To Reproduce
Expected behavior
The sketch compiles.
Additional context
I haven't worked with the Arduino IDE for a while, but if I understand it correctly, the ino files are glued together and then compiled. The ino IDE should have been compiled with /tmp/arduino_build_241219/sketch/Super_Simple_RGB_WiFi_Lamp.ino.cpp at the top of the compiled file, so that forward declarations of the functions are known throughout the namespace. But I don't find these forward declarations in this file.
I just don't understand if this is a consequence of the environment, e.g. an incompatibility of the libraries or similar.
Can you give me a hint?
Verbose output of arduino-ide: