I'm working on a large project (over 200K compiled) on a Teensy 3.6 running Win 10 and developed in the Arduino IDE. The project is spread over 19 files: 1 *.ino file, 1 *.h file, and 17 *.cpp files. (It's an Open Source project and code can be downloaded from hamradiodesigns.com) The source code compiles/uploads fine under 1.8.7. There are a number of warnings, and all but two are from library files. However, 1.8.8 fails to compile.
I have tracked the problem down to two source code files that are defined (not declared) in two different libraries. When I remove those two files from one of the libraries, the code compiles/uploads under both 1.8.7 and 1.8.8. . This makes me think that the parsing of library files has changed in a way that no longer permits duplicate definition errors in the libraries.
Has anyone else observed this behavior? If so, I'm not sure of the best way to "fix" the problem, since neither library is mine, but they are needed for the code to work. Having two versions of the same library is never a good idea, but I don't see a good way around it. Ideas?
Library parsing is done via the arduino-builder tool. Both Arduino IDE 1.8.7 and 1.8.8 use the same version of arduino-builder (1.4.1).
Looking at the release notes, the differences between the two considered noteworthy by the developers are only in the UI. Looking at the commit history between the two releases doesn't reveal anything significant to me either:
Yes post the error so we can see what is happening.
Even better post the entire verbose compile output so we can see all the files being compiled and the libraries being used and their locations.
One thing I noticed in the code is this:
#include <Time.h> // https://github.com/PaulStoffregen/Time
#include <TimeLib.h> // Part of the Stoffregen library, done for backward compatibiliity
Those two header files are both from the same library.
You should only ever be including one of them not both.
The original header file name for that library was Time.h
however Windows doesn't properly handle case in file names.
It ignores case in filenames. This means that Time.h and time.h are treated the same.
Because newer versions of the gcc and some core tools can include their own time support which uses a time.h header file, attempting to include Time.h can and usually does cause issues on Windows machines with those newer toolsets.
Essentially what is happening is a header file name collision. When that happens very odd things can happen as the IDE can totally screw things up because it depends on building an include path to locate the library header files and Arduino libraries.
When there is a collision it can be unpredictable which header file you end up getting included and which library library gets used.
Which file ends up being used can depend on the order of other library include files relative to the one with the name collision, spelling of the colliding files or even when the colliding files were created.
Basically, header filename collisions are a really bad thing and depending on many factors, the Arduino project might compile and link just fine, might not compile, or might compile but fail to link.
Because of this header file name collision issue with Time.h vs time.h on Windows, Paul added TimeLib.h to the library to work around this Windows limitation.
By using TimeLib.h instead of Time.h it avoids the issue of Windows having issue with Time.h vs time.h
So if using a Windows OS you must not use Time.h but rather TimeLib.h
Using TimeLib.h is the ideal solution since that will work on all OS versions and all cores.