IDE 2.0
I compiled w/o errors one sketch which included a call [setTime()] to library file: TimeLib.h. No errors.
I then added/pasted that sketch code to another existing sketch along with the requisite [#include <TimeLib.h>] and it says it cannot find the file. ???
Same processor: UNO WiFi Rev2.
I included a screenshot of the folders under the IDE libraries folder showing Time and Time-master, which are identical. Time-master being the one I downloaded and installed in the Libraries folder for TimeLib.h.
Even though they are supposedly identical if you try to compile code with a setTime() function call using only Time.h it will error out:
error: 'setTime' was not declared in this scope ^
I am fundamentally failing to understand some nuance here is all I can figure out. ....help...
hashtag_includes.h:
#include <SPI.h>
#include <WiFiNINA.h>
#include <math.h>
#include <TimeLib.h>
#include <DallasTemperature.h> // for DS18B20 digital sensor
#include <OneWire.h> // for DS18B20 digital sensor
#include <StackString.hpp> // save memory using this function: character arrays
using namespace Stack;
Compiler error message:
In file included from C:\Users\Ed\IDE 2.0 Sketches-Libraries\Boiler_House_v6K\Boiler_House_v6K.ino:32:0:
C:\Users\Ed\IDE 2.0 Sketches-Libraries\Boiler_House_v6K\hashtag_includes.h:6:10: fatal error: TimeLib.h: No such file or directory
#include <OneWire.h> // for DS18B20 digital sensor
^~~~~~~~~~~
compilation terminated.
Multiple libraries were found for "OneWire.h"
Used: C:\Users\Ed\IDE 2.0 Sketches-Libraries\libraries\OneWireNg
Not used: C:\Users\Ed\IDE 2.0 Sketches-Libraries\libraries\OneWireNg
exit status 1
Compilation error: TimeLib.h: No such file or directory
I am now completely befuddled.
In abiding to your request for "minimal code" I went in and gutted void loop() since the section I added to the existing sketch involved function setTime() and it was being called in void setup(). Now it compiles w/o an error and "sees" the TimeLib.h file.
Why emptying the contents of void loop() removed the "TimeLib.h file/directory not found" compiler error is perplexing. Am I going to need to rewrite this code and add snippets at a time, compile, and rebuild this sketch from the ground up?
...this is demoralizing....lol
edit-
I should add I also gutted a large part of my constants.h file since those values were related to the content in void loop().
10-4... I DO that faithfully. Rev 1D....1E....1F... and so on.
I simply created another sketch that obtained UNIX epoch time off the LAN and set the UNO RTC. I added it to my exisitng 'error free' main code and all hell broke loose.
It is going to take time to get things sorted out but I feel like I do not understand something fundamental, whatever it is, to this whole code creation process.
Be aware that the compiler will let you know when there is an error in your code, its position and its type.
But sometimes (more often than not) it decides to test your patience and misleads you about the real cause of the error and its location.
Failure to close parenthesis, braces and brackets is common. Frequent use of Control-T to re-format your code, proper indentation, consistent placement of semicolons and closing braces and sensible use of variable names all contribute to preventing mistakes and keeping the compiler running smoothly.
I appreciate your insight and have gotten better with keeping bracket placement aligned
and other common mistakes.
A huge tool is making small changes, successfully compiling and then changing the filename version. This one practice can help maintain your sanity.