I noticed that when I include the ESP8266WiFi.h in a sketch, it forces the use of function declarations, otherwise I get a "not declared in this scope" error.
Here's a minimum code example:
This compiles just fine
#include <Ethernet.h>
void setup() {
Serial.begin(9600);
testFunction();
}
void loop() {
}
void testFunction()
{
Serial.println("test");
}
This on the other hand, gives a compilation error complaining that testFunction was not declared in the scope
(error: 'testFunction' was not declared in this scope)
#include <ESP8266WiFi.h>
void setup() {
Serial.begin(9600);
testFunction();
}
void loop() {
}
void testFunction()
{
Serial.println("test");
}
Therefore, if I include the ESP8266WiFi.h I need to add the function declaration "void testFunction();" somewhere before the setup() function.
So the question is why does including the ESP8266WiFi.h have this effect?
Thanks!