I found out about a strange behavior of the IDE (and not sure if that problem was there in previous versions or not).
If you have a sketch with .ino and multiple .cpp files and you include a library header file in the .cpp only, then the compilation will fail.
If you add the header to the .ino file, then it will all compile well.
Example of Error:
file1.ino
#include <Arduino.h>
#include "file2.h"
void setup() { }
void loop()
{
file2_func();
}
file2.cpp
#include <OneWire.h>
OneWire ow(10);
void file2_func()
{
ow.reset();
}
file2.h
void file2_func();
Example of working sketch
file1.ino
#include <Arduino.h>
// Must include the below here, otherwise file2.cpp will not compile
#include <OneWire.h>
#include "file2.h"
void setup() { }
void loop()
{
file2_func();
}
and the reset of the files could be the same.
Obviously this is not the most desired behavior. Am I missing something?