time.h-----fatal error: time.h: No such file or directory

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

when I include time.h, I got

: fatal error: time.h: No such file or directory

 

what's wrong?

 

please help! thanks

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tom62 wrote:
what's wrong?

Exactly what the message says - it can't find that file!

 

2 possible reasons:

  1. You don't have the file at all, anywhere;
  2. You do have it, but it's not in any place that the compiler's looking.

 

To fix No 2, you need to correctly configure your Include Paths; you haven't said what toolchain you're using, so it's impossible to give specific instructions - but searching for "Include Path" in the documentation should get you there...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't you have to tell us which toolchain and version you are using?

 

When you do that and search the forums for time.h support in GCC, what threads do you find?

 

From 2008:  https://www.avrfreaks.net/comment...

 

I seem to recall some threads about at least some support added for AVR8 targets.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Mon. Feb 20, 2017 - 07:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

time.h was added to avr-gcc in AVR-LibC 2.0 which (I think) started to be used around about v 4.8 so if you have a compiler from before then (for example WinAVR was 4.3) it won't have it.

 

Then again maybe it's not even gcc?

 

Studio 7 has 4.9.2 - it definitely has time.h