Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

time.h Compile errors with WD v2.0
#1

I'm new to Arduino dev, so please bear with me! After successfully building the TX software I'm trying to build the latest WD with Arduino IDE 1.8.0

I get a slew of errors relating to missing declarations from time.h (See examples below). The time library is installed, but I think the correct include file is never being loaded but the file "time.h" from "C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include" is being loaded instead.

I could rename the "time.h" library but that seems bit of a sledgehammer approach. Suggestions?


Code:
D_TFT1:412: error: 'day' was not declared in this scope

       sprintf(Clock_buf, "%02d-%02d-%d", day(), month(), year());

                                              ^

D_TFT1:412: error: 'month' was not declared in this scope

       sprintf(Clock_buf, "%02d-%02d-%d", day(), month(), year());

                                                       ^

D_TFT1:412: error: 'year' was not declared in this scope

       sprintf(Clock_buf, "%02d-%02d-%d", day(), month(), year());
Reply
#2

Hi roddyp

Under MyDocumments folder, create a folder called "Arduino", and under that folder create another one called "libraries", then put inside that folder all the libraries included on the WeatherDuino Pro2 software package.

Close de Arduino IDE and start it again. All should compile ok now.

Reply
#3

Always restart the IDE when you add new libraries.
Reply
#4

(08-01-2017, 08:19)zitoune Wrote:  Always restart the IDE when you add new libraries.

Tried this, and all the above with no effect.

The solution seems to be to update the Time library via the library manager, and then  change RX and WD source from this

#include <Time.h>

... to this

#include <TimeLib.h>

I'm unsure why nobody else is seeing this problem. Are you using the latest 1.8.0 Arduino IDE on Windows?  Looking at the github history, it looks like the header arrangement was radically changed for the time library for compatibility with 1.6.6 IDE?

Here's an earlier report. http://forum.arduino.cc/index.php?topic=...msg2860438
Reply
#5

Hi roddyp,

I think you haven't loaded libraries "Time" yet ...

I recommend you to:

1) Open Arduino IDE
2) Open the project: "File" -> "Open" -> ".../WeatherDuino_Pro2_WD_v2.0_b007.ino"
You will get the second windows of IDE, the first you can close.
3) Import library: "Project" -> "Library import" -> "Add library" -> ".../WeatherDuino_Pro2/v2.0/libraries/Time"
Every time you have to use the libraries from Werk_AG install package. The location depends on where you unwrapped the .rar file.
And the "Time" is all Time library directory. I am sure, you don't need restart IDE. That you had to do only then if you delete old library.

This way, you have to load all libraries if they are not installed already, which are listed at the beginning of the main .ino file
(in this case "WeatherDuino_Pro2_WD_v2.0_b007", the first page).
Good luck.
Regards
Zdenek

Best Regards
Zdenek

Brandys/L Weather
Reply
#6

Thanks. As before, the libraries from the Weatherduino RAR are installed fine.

BUT the "time" library in the RAR is out of date (2014), and won't work with Arduino 1.6.6 or later, so you need to get the 1.5 version here: https://github.com/PaulStoffregen/Time/releases

... And then, once you've done that you should include timelib.h rather than time.h (see the updated time library examples) because on Windows "Time.h" == "time.h", which is a standard AVR library header. If you're using a case-sensitive filesystem it probably isn't a problem.
Reply
#7

(08-01-2017, 17:45)roddyp Wrote:  Thanks. As before, the libraries from the Weatherduino RAR are installed fine.

BUT the "time" library in the RAR is out of date (2014), and won't work with Arduino 1.6.6 or later, so you need to get the 1.5 version here: https://github.com/PaulStoffregen/Time/releases

... And then, once you've done that you should include timelib.h rather than time.h (see the updated time library examples) because on Windows "Time.h" == "time.h", which is a standard AVR library header. If you're using a case-sensitive filesystem it probably isn't a problem.

Hmm,

I don't understand it -  I'm using two computers with Windows 10, one is 32 bit, IDE 1.8.0, the second is 64 bit with IDE 1.7.10. And I use Time library from
.rar package without any problems ...
In this case, I would try to uninstall the entire IDE, delete the old directories and do a completely new installation. Sorry, otherwise, unfortunately I can not advise. Sad

===================================================================================

New editing post:

Sorry, roddyp,

I tried to compile and got the same result as you ... Sad

Maybe it is because I installed it with IDE 1.7.10. With IDE 1.8.0 I tried to do some others very small projects ... Once again, excuse me.
So: When I installed again IDE 1.7.10, it was possible to use Time library from .rar package and was possible to compile it.

For now I recommend to you to use this version IDE, you can find it at Previous Arduino IDE versions.

Good luck again.

Regards
Zdenek

Best Regards
Zdenek

Brandys/L Weather
Reply
#8

(08-01-2017, 18:41)hornychz Wrote:  Hmm,

I don't understand it -  I'm using two computers with Windows 10, one is 32 bit, IDE 1.8.0, the second is 64 bit with IDE 1.7.10. And I use Time library from
.rar package without any problems ...

In this case, I would try to uninstall the entire IDE, delete the old directories and do a completely new installation. Sorry, otherwise, unfortunately I can not advise. Sad

I don't understand it either Wink   I've tried fresh install of Arduino and all libraries, and every time the same result. Windows 10, x64. I'll have to try it on a different PC next.

I guess the first question to ask is : Do you have a file called "time.h" here? C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include
(This is part of the avr platform library rather than the "Time" library, and I think gets installed as part of ther Arduino setup)

The second question is what version of Time library does Arduino think you have installed? (from Sketch/Include Library/Library Manager)

I'll put that on hold for now!
Reply
#9

(08-01-2017, 18:41)hornychz Wrote:  I tried to compile and got the same result as you ... Sad

Thanks for the update - I hadn't read that before I replied.

It would be useful if you can verify that my 'fix' works for 1.8.0 (update Time to 1.5 and use "Timelib.h" instead of "time.h") - also that it's OK with 1.7

I can't test the code with a real system yet, as my Weatherduino is still  a collection of IC's and modules in transit from across the globe. Rolleyes
Reply
#10

Hi roddyp

Quote:BUT the "time" library in the RAR is out of date (2014), and won't work with Arduino 1.6.6 or later, so you need to get the 1.5 version here: https://github.com/PaulStoffregen/Time/releases

Please, please, always use the libraries supplied with the software, even if there are updates for them. Some libraries could have been customized for the WeatherDuino Pro2. The included "time" library is working perfectly with IDE 1.7.11

All the software compiles without any problems with Arduino IDE 1.7.11, but it is not working with the new Arduino IDE 1.8.0

I strongly suggest you to delete all installations of your Arduino IDE, and install just Arduino IDE 1.7.11.

Reply




Users browsing this thread: 1 Guest(s)