I have been trying to get to grips with reducing the compile time of my project (several minutes!).
I had deep search for libraries enabled so disabled this only to get loads of
no such file or directory errors. With deep search enabled my project compiles without errors - just verrrrrry slowly...
I slowly went through and added these using Micro Explorer (Explore platforms/Esp8266/Libraries/All) and clicking on each supposedly missing library - the 'strange' thing is that each added library adds the library to the solution - is this correct?
Also, the headers were added to the project .ino file.
I like to separate headers from code as for me it is neater and easier to work on so I have a header file that includes all the headers that is then #included in the .ino and in other .h files where needed.
After adding the libraries as above all compiled ok.
As it seemed strange to have the libraries included in the solution I tried deleting one.
To my surprise my project then failed to compile although the library header was in my header file.
Experimenting I have discovered the following: If a library header is included in the .ino file then the project will compile.
If the library header is included in a header file that is included in the .ino file the library is not found.
See the following that compiles correctly:
File: Sketch1.ino
#include <Wire.h>
void setup() {
Wire.begin(4, 5);
}
void loop() {
}
..and the following that does not:
File: Sketch1.h
#include <Wire.h>
File: Sketch1.ino
#include "Sketch1.h"
void setup() {
Wire.begin(4, 5);
}
void loop() {
}
Is this an 'Arduino' "Feature" or should this work correctly?
Is this a case for having just an empty .ino file (so VM et al recognises it as an Arduino project) and the code in a .cpp file with its associated header?