Skip to content

error: 'time_t' has not been declared in HardwareSerial.h #5644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pat1 opened this issue Jan 20, 2019 · 6 comments · Fixed by #5648
Closed

error: 'time_t' has not been declared in HardwareSerial.h #5644

pat1 opened this issue Jan 20, 2019 · 6 comments · Fixed by #5648

Comments

@pat1
Copy link

pat1 commented Jan 20, 2019

in the last git version using hardware serial I get at compile time:
packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/HardwareSerial.h:210:34: error: 'time_t' has not been declared
unsigned long detectBaudrate(time_t timeoutMillis);

this little patch solve the problem:
diff --git a/cores/esp8266/HardwareSerial.h b/cores/esp8266/HardwareSerial.h
index ce9a1c5..5f083f7 100644
--- a/cores/esp8266/HardwareSerial.h
+++ b/cores/esp8266/HardwareSerial.h
@@ -30,6 +30,7 @@
#include <inttypes.h>
#include "Stream.h"
#include "uart.h"
+#include "time.h"

enum SerialConfig {
SERIAL_5N1 = UART_5N1,

@Jason2866
Copy link
Contributor

Jason2866 commented Jan 20, 2019

You are using core 2.4.0. Latest git version is 2.5.0?!
packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/HardwareSerial.h
It seems your setup is outdated / wrong

@andrethomas
Copy link

@pat1 Core 2.4.0 issues are no longer supported. Please upgrade to 2.5.0-beta2 and if the issue persists please re-open the issue and complete all the required information from the template.

Please also close this issue as it is no longer relevant.

@pat1
Copy link
Author

pat1 commented Jan 21, 2019

if I say that it is the last git version it is.
You look at the name of directory that is not the same (I start to work with 2.4.0 version a long time ago and the dir was not changed).
[pat1@localhost 2.4.0]$ git pull
Already up-to-date.
[pat1@localhost 2.4.0]$ git branch

  • master

@d-a-v
Copy link
Collaborator

d-a-v commented Jan 21, 2019

if I say that it is the last git version it is.

Noboby is questioning your sincerity.
However, nobody has this issue.
If you are working with a tree from 2.4.0 and only updated it with git pull, you may find it useful to execute again cd tools; python ./get.py. The toolchain has been updated since 2.4.0.

@pat1
Copy link
Author

pat1 commented Jan 21, 2019

[pat1@localhost bin]$ ./xtensa-lx106-elf-c++ --version
xtensa-lx106-elf-c++ (crosstool-NG 1.20.0) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I get the same after cd tools; python ./get.py

The problem is not the toolchain; the use of time_t is possible only after the appropriate #include
In the most of the use cases you use the serial with other library that include time.h
To reproduce you have to link a library that use only one include
#include <HardwareSerial.h>
that library cannot compile.

@d-a-v
Copy link
Collaborator

d-a-v commented Jan 21, 2019

In the most of the use cases you use the serial with other library that include time.h
To reproduce you have to link a library that use only one include
#include <HardwareSerial.h>
that library cannot compile.

Ah, this is useful info to help us understand your issue,
thanks.

d-a-v added a commit to d-a-v/Arduino that referenced this issue Jan 21, 2019
earlephilhower pushed a commit that referenced this issue Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants